@dot-event/log
v1.0.34
Published
dot-event logger
Downloads
9
Readme
@dot-event/log
dot-event logger
Install
npm install dot-event @dot-event/log
Setup
Add the logger right after you initialize your dot-event instance:
const dot = require("dot-event")()
require("@dot-event/log")(dot)
This creates the dot.log
emitter.
Log levels
There are five log levels: debug
, trace
, info
, warn
, and error
.
By default, the logger only logs info
or above, but you can change that with logLevel
:
dot("logLevel", { arg: "debug" })
Automatic logging
By default, the logger logs any and all events at log level info
.
If your event is very noisy, you might want to opt to alias info
logs to debug
for that particular event:
dot("logLevel", "myEvent", { info: "debug" })
Manual logging
dot.log("warn", { arg: "some scary message here" })