-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: memory leak related to logging within server-side rendering (#520)
- Loading branch information
Martin Stadler
authored
Sep 26, 2020
1 parent
6c0974a
commit 88ba368
Showing
3 changed files
with
36 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,3 @@ | ||
import * as winston from 'winston'; | ||
import { createLogger } from '@/server/utils/createLogger'; | ||
|
||
export const Logger: winston.Logger = winston.createLogger({ | ||
transports: [ | ||
new winston.transports.File({ | ||
filename: 'logs/error.log', | ||
level: 'error', | ||
maxFiles: 5, | ||
maxsize: 10485760, | ||
format: winston.format.combine(winston.format.splat(), winston.format.json()), | ||
}), | ||
new winston.transports.File({ | ||
filename: 'logs/all.log', | ||
maxFiles: 5, | ||
maxsize: 10485760, | ||
format: winston.format.combine(winston.format.splat(), winston.format.json()), | ||
}), | ||
new winston.transports.Console({ | ||
level: 'debug', | ||
handleExceptions: true, | ||
format: winston.format.combine(winston.format.splat(), winston.format.colorize(), winston.format.simple()), | ||
}), | ||
], | ||
exitOnError: false, | ||
}); | ||
export const Logger = createLogger(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as winston from 'winston'; | ||
|
||
export const createLogger = () => { | ||
return winston.createLogger({ | ||
transports: [ | ||
new winston.transports.File({ | ||
filename: 'logs/error.log', | ||
level: 'error', | ||
maxFiles: 5, | ||
maxsize: 10485760, | ||
format: winston.format.combine(winston.format.splat(), winston.format.json()), | ||
}), | ||
new winston.transports.File({ | ||
filename: 'logs/all.log', | ||
maxFiles: 5, | ||
maxsize: 10485760, | ||
format: winston.format.combine(winston.format.splat(), winston.format.json()), | ||
}), | ||
new winston.transports.Console({ | ||
level: 'debug', | ||
handleExceptions: true, | ||
format: winston.format.combine(winston.format.splat(), winston.format.colorize(), winston.format.simple()), | ||
}), | ||
], | ||
exitOnError: false, | ||
}); | ||
}; |