Browse Source

loggging fix

Timothy Pomeroy 6 years ago
parent
commit
2d088694e8
1 changed files with 12 additions and 12 deletions
  1. 12 12
      index.js

+ 12 - 12
index.js

@@ -148,18 +148,18 @@ const processWithHandbrake = (input, output, preset) => {
         processOutput(` -> processing "${inputName}" to "${outputName}" with "${preset}"`);
       })
       .on('error', err => {
-        processOutput(` -> processing ${outputName} error: ${err.message || err}.\n`);
+        processOutput(` -> processing "${outputName}" error: ${err.message || err}.\n`);
         reject(err);
       })
       .on('progress', progress => {
-        processOutput(` -> processing ${outputName} - ${progress.percentComplete}%, ETA: ${progress.eta}`);
+        processOutput(` -> processing "${outputName}" - ${progress.percentComplete}%, ETA: ${progress.eta}`);
       })
       .on('cancelled', () => {
-        processOutput(` -> processing ${outputName} cancelled\n`);
-        reject(new Error(`Processing ${outputName} cancelled`));
+        processOutput(` -> processing "${outputName}" cancelled\n`);
+        reject(new Error(`Processing "${outputName}" cancelled`));
       })
       .on('complete', () => {
-        processOutput(` -> processing ${outputName} complete\n`);
+        processOutput(` -> processing "${outputName}" complete\n`);
         resolve(true);
       });
   });
@@ -192,7 +192,7 @@ const processFile = async file => {
         return false; // break this loop
       } else if (!found) {
         // was it found? .. nope
-        processOutput(` -> ${path.basename(file)} [processing]`);
+        processOutput(` -> "${path.basename(file)}" [processing]`);
         setFile(db, {
           input: file,
           output: '',
@@ -200,7 +200,7 @@ const processFile = async file => {
           date: new Date(),
         }); // push onto the list an entry
       } else {
-        processOutput(` -> ${path.basename(file)} [re-processing]`);
+        processOutput(` -> "${path.basename(file)}" [re-processing]`);
         setFile(db, file, {
           status: '',
           date: new Date(),
@@ -240,7 +240,7 @@ const processFile = async file => {
   if (fs.existsSync(output)) {
     let outputSize = await getFilesize(output); //get output filesize
     if (outputSize > 100) { //make sure its bigger than 100k
-      processOutput(` -> ${path.basename(file)} [skipping ... already processed]\n`);
+      processOutput(` -> "${path.basename(file)}" [skipping ... already processed]\n`);
       setFile(db, file, {
         output: output,
         status: 'success',
@@ -256,7 +256,7 @@ const processFile = async file => {
   });
   // create parent if required
   if (target && !fs.existsSync(target)) {
-    processOutput(` -> creating parent directory: ${target}\n`);
+    processOutput(` -> creating parent directory "${target}"\n`);
     fs.mkdirSync(target, {
       recursive: true,
     });
@@ -368,11 +368,11 @@ const main = async () => {
     })
     .on('change', file => {
       // when a file changes ...
-      console.log(` -> ${file} has been changed`);
+      console.log(` -> "${file}" has been changed`);
     })
     .on('unlink', async file => {
       // when a file is removed ...
-      console.log(` -> ${file} has been removed`);
+      console.log(` -> "${file}" has been removed`);
       cleanup(file);
     })
     .on('error', error => {
@@ -383,5 +383,5 @@ const main = async () => {
 (async () => {
   main();
 })().catch(err => {
-  console.log('Error:', err.message || err);
+  console.log(` -> Error: ${err.message || err});
 });