Skip to content

Commit

Permalink
Merge pull request #773 from jorenn92/fix-broken-image-after-winston-…
Browse files Browse the repository at this point in the history
…upgrade

refactor: fix the broken server start after the Winston upgrade
  • Loading branch information
jorenn92 authored Jan 19, 2024
2 parents f8fa98e + a72a8ce commit 262eac1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { WinstonModule } from 'nest-winston';
import winston from 'winston';
import DailyRotateFile from 'winston-daily-rotate-file';
import chalk from 'chalk';
import path from 'path';

async function bootstrap() {
const app = await NestFactory.create(AppModule, {
Expand Down Expand Up @@ -47,13 +48,16 @@ async function bootstrap() {
transports: [
new winston.transports.Console(),
new DailyRotateFile({
filename: '../data/logs/maintainerr-%DATE%.log',
filename: path.join(
__dirname,
`${process.env.NODE_ENV !== 'production' ? '../' : ''}../data/logs/maintainerr-%DATE%.log`,
),
datePattern: 'YYYY-MM-DD',
zippedArchive: true,
maxSize: '20m',
maxFiles: '7d',
format: winston.format.combine(
winston.format.timestamp({ format: 'DD/MM/YYYY HH:mm:ss' }), // winston.format.timestamp({ format: 'YYYY-MM-DDTHH:mm:ss.SSSZ' }),
winston.format.timestamp({ format: 'DD/MM/YYYY HH:mm:ss' }),
winston.format.printf(({ level, message, timestamp, context }) => {
return `[maintainerr] | ${timestamp} [${level.toUpperCase()}] [${context}] ${message}`;
}),
Expand Down

0 comments on commit 262eac1

Please sign in to comment.