mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
more formatting
This commit is contained in:
1 parent
046447b0fb
commit
f552c1212c
157 files changed
+635
-1579
No files matched your search
@@ -3,15 +3,12 @@ import config from '../utils/config';
|
||||
import path from 'path';
|
||||
|
||||
// Needed to manually apply a color to componenent property of log
|
||||
const manualColorize = (strToColor: string): string =>
|
||||
`[\x1b[35m${strToColor}\x1b[0m]`;
|
||||
const manualColorize = (strToColor: string): string => `[\x1b[35m${strToColor}\x1b[0m]`;
|
||||
|
||||
// Format handler passed to winston
|
||||
const formatLogs = (log: winston.Logform.TransformableInfo): string => {
|
||||
if (log.module)
|
||||
return `${log.label} ${manualColorize(log.module)} [${log.level}]: ${
|
||||
log.message
|
||||
}`;
|
||||
return `${log.label} ${manualColorize(log.module)} [${log.level}]: ${log.message}`;
|
||||
|
||||
return `${log.label} [${log.level}]: ${log.message}`;
|
||||
};
|
||||
@@ -28,14 +25,14 @@ export const mainLogger = winston.createLogger({
|
||||
format: winston.format.combine(
|
||||
winston.format.errors({ stack: true }),
|
||||
winston.format.timestamp(),
|
||||
winston.format.json()
|
||||
winston.format.json(),
|
||||
),
|
||||
}),
|
||||
new winston.transports.Console({
|
||||
format: winston.format.combine(
|
||||
winston.format.label({ label: '[NPWD]' }),
|
||||
winston.format.colorize({ all: true }),
|
||||
winston.format.printf(formatLogs)
|
||||
winston.format.printf(formatLogs),
|
||||
),
|
||||
}),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user