emit logger
npm install @emit-js/emit @emit-js/log
const emit = require("@emit-js/emit")()
require("@emit-js/log")(emit)
This creates the emit.log
emitter.
There are five log levels: debug
, trace
, info
, warn
, and error
.
By default, the logger only logs warn
or above, but you can change that with logLevel
:
emit("logLevel", "debug")
You could also set the environment variable LOG=debug
.
By default, the logger logs all events at log level debug
.
You might want to change debug
logs to info
for certain events:
emit("logLevel", "myEvent", { debug: "info" })
emit.log("logs at info by default")
emit.log("warn", "warning!")