@fraserdarwent/javascript-logger
v1.0.4
Published
Simple level based logging library
Downloads
3
Maintainers
Readme
logger
A simple Javascript level based logging library
Usage
Import
const log = require("@fraserdarwent/javascript-logger");
Usage
Set Level
log.setLevel(log.levels.TRACE);
Log
log.trace("foo");
log.debug("foo");
log.info("foo");
log.warn("foo");
log.error("foo");
log.fatal("foo");
Example Output
2020-02-03T16:49:05.462Z [TRACE] foo
2020-02-03T16:49:05.469Z [DEBUG] foo
2020-02-03T16:49:05.469Z [INFO] foo
2020-02-03T16:49:05.469Z [WARN] foo
2020-02-03T16:49:05.469Z [ERROR] foo
2020-02-03T16:49:05.471Z [FATAL] foo
Available levels
TRACE
: Logs to stdoutDEBUG
: Logs to stdoutINFO
: Logs to stdout (default value)WARN
: Logs to stdoutERROR
: Logs to stderrFATAL
: Logs to stderr then exits process