Work in progress
Just another logger, based on DEBUG, with call site details and pretty printing.
Uses the DEBUG
env variable to figure out whether to log or not.
Create a logger using (see Flags for options)
const logger = cimico('app:parser', {
format: false,
color: true,
pretty: true,
timestamp: false,
filename: true,
});
If the DEBUG
variable is set to *
, app:*
, app:parser
or app:parser:*
, then the logs will appear
The methods available to logger
are with their shorthands
log/l
(stdout)success/s
(stdout)debug/d
(stdout)error/e
(stderr)
Chance the way the method work by using,
format/f
, allows the use of format string, see belowcolor/c
, turns color onpretty/p
, prints errors and objects in a pretty waytimestamp/ts
, adds timestamp to header labelfilename/fn
, add filename to header label
When formatting flag is used or format
is true
in options, the a format string can be used to render the data.
d
for dimb
for boldu
for underline(name)
for key value pair
Eg,
logger.format.log('This is bold=%b or %b(bold)', 'one', 'two');