Skip to content
Extraits de code Groupes Projets
Vérifiée Valider ab62341a rédigé par Kubat's avatar Kubat
Parcourir les fichiers

MISC: Update logger

parent c0af840b
Branches
Étiquettes
2 requêtes de fusion!3Dev kubat,!1Create basic lib
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
const winston = require('winston'); const winston = require('winston');
const __loggerCustomLevels = { const __loggerCustomLevels = {
label: "default",
levels: { levels: {
debug: 3, debug: 3,
info: 2, info: 2,
...@@ -28,12 +29,21 @@ const __loggerCustomLevels = { ...@@ -28,12 +29,21 @@ const __loggerCustomLevels = {
} }
}; };
const __myFormat = winston.format.printf(({ level, message, label, timestamp }) => {
return `[${timestamp}] ${level}\t ${message}`;
});
module.exports = global.logger = module.exports = winston.createLogger({ module.exports = global.logger = module.exports = winston.createLogger({
transports: [new winston.transports.Console()], transports: [new winston.transports.Console()],
level: "debug", level: "debug",
json: false,
handleExceptions: true,
levels: __loggerCustomLevels.levels, levels: __loggerCustomLevels.levels,
format: winston.format.combine( format: winston.format.combine(
winston.format.timestamp({format: 'YYYY-MM-DD HH:mm:ss'}),
winston.format.label(),
winston.format.colorize({ all: true }), winston.format.colorize({ all: true }),
winston.format.simple() winston.format.simple(),
__myFormat
) )
}); });
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter