Logger
A different signale.
Charlog is a custom Logger with many features with the main focus to be appealing.
This is heavily inspired by signale, please use signale if you are looking for a fully supported and steady updated logger.
Just install the package with npm (or yarn).
npm i charlog --save
Then require the class and use it:
const Charlog = require('charlog');
const Logger = new Charlog();
Logger.error('This is a cool %a', 'Error');
The class constructor takes an options
object.
You can use all of these config options global when putting it into the package json file under “charlog”.
interactive
Boolean
Default: false
Enables the interactive mode. In this mode the recent logged line will be replaced with the new one.
uppercaseTag
Boolean
true
Enables the caps lock for tags.
tag
String
Main
The Tag which appears in front of the log message.
date
Boolean
false
Enables that the date is shown before the log message.
timestamp
Boolean
false
Enables that the current time is shown before the log message.
setFileLength
Number
0
Set the length of the longest filename including extension (only needed if filename
is enabled)
longestTagName
Number
0
Set the length of the longest tag name.
filename
Boolean
true
Enabling that the filename is shown before the log message.
loggers
Object
Set custom loggers.
Logger
"nameOfLogger": {
tag: 'TAG',
color: 'color'
}
MIT