jfLogger
Class for manipulating logs and traces.
Can be used as base class for reporting class or node scripts.
Extend jfObject inheriting all its features and functionalities.
Use jfTranslations so messages can be translated in other languages.
Usage
Example
const jfLogger = require('jf-logger');
jfLogger.translations.addLanguage('en');
// Using new
const logger = new jfLogger();
// As singleton
const logger = jfLogger.i();
logger.log( // 12:34:56 [jfLogger ] You must set field `name`
'warn',
'', // If empty, class name is used.
'Debes asignar el campo `%s`',
'name'
);
logger.log( // 12:34:56 Min length for `Description` is 10 chars.
'warn',
false, // If false, name is hidden.
'La longitud mínima para `{name}` es {minLength}',
{
name : 'Description',
minLength : 10
}
);
Removing/changing colors
If you want differents colors or not colors at all you can overwrite
addColorsToLogParams
.
If you use an empty function you will remove all colors in parameters.