You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
526 B
24 lines
526 B
import winston from 'winston';
|
|
|
|
import { isDev } from './env.js';
|
|
|
|
const { combine, timestamp, label, simple, json, colorize } = winston.format;
|
|
|
|
const dev = combine(
|
|
colorize(),
|
|
label({ label: 'Wetty' }),
|
|
timestamp(),
|
|
simple(),
|
|
);
|
|
|
|
const prod = combine(label({ label: 'Wetty' }), timestamp(), json());
|
|
|
|
export const logger = winston.createLogger({
|
|
format: isDev ? dev : prod,
|
|
transports: [
|
|
new winston.transports.Console({
|
|
level: isDev ? 'debug' : 'info',
|
|
handleExceptions: true,
|
|
}),
|
|
],
|
|
});
|
|
|