In version 4.x the capitalization of log level has been changed to camel casing.
// IN 3.xconsole.loglevel =3;// IN 4.xconsole.logLevel =3;
Colors
In version 4.x the syntax for defining colors in the configuration has been overhauled, and colorization is now done using chalk, instead of raw strings.
// IN 3.xrequire('better-logging')(console, {typeColors: Color => ({ debug:Color.Light_Purple, info:Color.Light_Purple, log:Color.Light_Purple, error:Color.Blue, warn:Color.Blue, }),stampColor: Color =>Color.Light_Green});console.color.Blue;// IN 4.xconstchalk=require('chalk');require('better-logging')(console, { color: { base:chalk.greenBright, type: { debug:chalk.magentaBright, info:chalk.magentaBright, log:chalk.magentaBright, error:chalk.blue, warn:chalk.blue, } },});chalk.blue
Arg Processor
In version 4.x the arg processor configuration has been removed.
// IN 3.xrequire('better-logging')(console, {argProcessor: arg => {// will fire once per arg in (...args) of the original function calllet msg = arg;if (typeof arg ==='number') { msg = arg * arg;// ex: log(1, 2, 3) => '1 4 9' }returnString(msg); // Should return a string }});// IN 4.x// Removed
Events
In version 4.x events have been temporarily removed.
// IN 3.xrequire('better-logging')(console, { events: [{onLogEmitted: log => {// A log just got emitted! },onLoglevelChanged: loglevel => {// The loglevel got changed } }]});// IN 4.x// Temporarily removed