This commit is contained in:
timothycarambat 2024-07-03 18:25:44 -07:00
parent 29c9eeaa5c
commit 8658b1e7c7
2 changed files with 7 additions and 4 deletions

View File

@ -5,7 +5,8 @@ class Logger {
static _instance; static _instance;
constructor() { constructor() {
if (Logger._instance) return Logger._instance; if (Logger._instance) return Logger._instance;
this.logger = process.env.NODE_ENV === 'production' ? this.getWinstonLogger() : console; this.logger =
process.env.NODE_ENV === "production" ? this.getWinstonLogger() : console;
Logger._instance = this; Logger._instance = this;
} }
@ -19,8 +20,9 @@ class Logger {
winston.format.colorize(), winston.format.colorize(),
winston.format.printf( winston.format.printf(
({ level, message, service, origin = "" }) => { ({ level, message, service, origin = "" }) => {
return `\x1b[36m[${service}]\x1b[0m${origin ? `\x1b[33m[${origin}]\x1b[0m` : "" return `\x1b[36m[${service}]\x1b[0m${
} ${level}: ${message}`; origin ? `\x1b[33m[${origin}]\x1b[0m` : ""
} ${level}: ${message}`;
} }
) )
), ),

View File

@ -5,7 +5,8 @@ class Logger {
static _instance; static _instance;
constructor() { constructor() {
if (Logger._instance) return Logger._instance; if (Logger._instance) return Logger._instance;
this.logger = process.env.NODE_ENV === 'production' ? this.getWinstonLogger() : console; this.logger =
process.env.NODE_ENV === "production" ? this.getWinstonLogger() : console;
Logger._instance = this; Logger._instance = this;
} }