import * as fs from 'fs';

class Logger {
    fileName: string;
    constructor(fileName: string) {
        this.fileName = fileName;
    }

    appendLine(line: string) {
        fs.appendFile(`logs/${this.fileName}`, `${new Date()}: ${line}\n`, function (err) {
            if (err !== null) {
                console.log(`Logger Error: ${err}`);
            }
        });
    }
}

export default Logger;
import * as fs from 'fs';

class Logger {
    fileName: string;
    constructor(fileName: string) {
        this.fileName = fileName;
    }

    appendLine(line: string) {
        fs.appendFile(`./logs/${this.fileName}`, `${new Date()}: ${line}\n`, function (err) {
            console.log(`Logger Error: ${err}`);
        });
    }
}

export default Logger;
--- 
+++ 
@@ -7,8 +7,10 @@
     }
 
     appendLine(line: string) {
-        fs.appendFile(`./logs/${this.fileName}`, `${new Date()}: ${line}\n`, function (err) {
-            console.log(`Logger Error: ${err}`);
+        fs.appendFile(`logs/${this.fileName}`, `${new Date()}: ${line}\n`, function (err) {
+            if (err !== null) {
+                console.log(`Logger Error: ${err}`);
+            }
         });
     }
 }
Fix logging null to console
