tiny-logger
A very tiny logger for nodejs
Installation
npm install --save node-tiny-logger
Usage
const logger =level: LoggerINFOlogger
Logger Options
level: LoggerFATAL | LoggerERROR | LoggerWARN | LoggerINFO | LoggerDEBUG | LoggerTRACEhandleLogEntry?: levelStr: string argsPassedToLogstream?: NodeJSWritableStream
level:
All logs below this level will be ignored. Eg: If you specify Logger.WARN, then log.error() will work, but log.info() will be ignored
handleLogEntry(levelStr: string, argsPassedToLog):
Optional log entry handler. If you provide it then logs will trigger options.handleLogEntry function instead of writing to options.stream (or process.stdout).
Eg:
const logger ={console}logger; // => ERROR [ 'a', 1, 2 ]
stream:
If provided (and handleLogEntry is not provided) then it will be used to write log. Defaults to process.stdout