@barmaglot/logger v1.2.2
barmaglot-logger
IT DOESN'T WORK PROPERLY YET
Barmaglot/logger is a light-weight logging util which also includes some additional stuff created for personal needs.
It's pretty easy configurable, but it also has limited capabilities, and that's why you probably wanna use something
more stable, like log4js
or winston
Logger:
Usage
npm i --save @barmaglot/logger
var bl = require("@barmaglot/logger");
bl.configure();
var logger = bl.getLoggerForFile(__filename);
Configuration
Config-object requires only an array of appenders, and looks something like this:
{
appenders: [ ... ]
}
Config isn't required. Default config object looks like this:
{
appenders: [{
target: {
type: "console"
},
format: "[%p] %d %m:%l",
level: {
min: "info",
max: "error"
}
}]
}
Appender config:
target
: only one required option. Includestype
field and some additional options depends ontype
value. Target types:console
: doesn't need any additional optionsfile
: requiresfilepath
option, which must include path to target file *url
: requiresurl
option, which must include url to server logging methodformat
: not required Can include next placeholders:%p
: log level (info, trace, debug etc.)%d
: date (now only in HH/MM/SS:MMM format)%m
: log message%l
: line numberlevel
: not required. Determines lowest and highest allowed log-levels for current appender Includes two fields:min
max
Log-levels order: info, debug, trace, warn, error, fatal