const fs = require ( 'fs' ) ; class Logger { logFile : any ; enabledLogging : boolean ; constructor ( logFilePath , enabledLogging ) { let fullPath = logFilePath ; if ( enabledLogging ) { this . logFile = fs . createWriteStream ( fullPath , { flags : 'a+' , encoding : 'utf8' } ) ; this . enabledLogging = true ; } else { this . logFile = { } ; this . enabledLogging = false ; } } public async writeToLogFile ( message ) { if ( this . enabledLogging ) { this . logFile . write ( message , 'utf8' ) ; } } } export default Logger ;