mirror of
https://github.com/kirameki-cafe/Yumi.git
synced 2026-09-13 18:59:19 +00:00
Updated dependencies and better logging (#17)
* Updated all deps * Changed logging format to JSON
This commit is contained in:
+12
-3
@@ -13,7 +13,7 @@ const levels = {
|
||||
const level = () => {
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
const isDevelopment = env === 'development';
|
||||
return isDevelopment ? 'debug' : 'info';
|
||||
return isDevelopment ? 'debug' : 'warn';
|
||||
};
|
||||
|
||||
const colors = {
|
||||
@@ -28,14 +28,23 @@ const colors = {
|
||||
|
||||
winston.addColors(colors);
|
||||
|
||||
const format = winston.format.combine(
|
||||
const consoleFormat = winston.format.combine(
|
||||
winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),
|
||||
winston.format.colorize({ all: true }),
|
||||
winston.format.printf((info) => `[${info.timestamp}] [${info.level}] ${info.message}`)
|
||||
);
|
||||
|
||||
const format = winston.format.combine(
|
||||
winston.format.timestamp({
|
||||
format: new Date().toISOString()
|
||||
}),
|
||||
winston.format.json()
|
||||
);
|
||||
|
||||
const transports = [
|
||||
new winston.transports.Console(),
|
||||
new winston.transports.Console({
|
||||
format: consoleFormat
|
||||
}),
|
||||
new winston.transports.File({
|
||||
filename: 'logs/error.log',
|
||||
level: 'error'
|
||||
|
||||
Reference in New Issue
Block a user