mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 14:37:41 +00:00
e9fc0bf5f7
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
24 lines
504 B
TypeScript
24 lines
504 B
TypeScript
import winston, {format} from 'winston';
|
|
|
|
const prettyJson = format.printf(info => {
|
|
if (typeof info.message === 'object') {
|
|
info.message = JSON.stringify(info.message, null, 4);
|
|
}
|
|
|
|
return `${info.level} :: ${info.message}`;
|
|
});
|
|
|
|
export const Logger = winston.createLogger({
|
|
level: process.env.LOG_LEVEL ?? 'info',
|
|
format: format.combine(
|
|
format.colorize(),
|
|
format.prettyPrint(),
|
|
format.splat(),
|
|
format.simple(),
|
|
prettyJson
|
|
),
|
|
transports: [
|
|
new winston.transports.Console({})
|
|
]
|
|
});
|