forked from redhat-developer/vscode-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlog.ts
More file actions
25 lines (23 loc) · 730 Bytes
/
log.ts
File metadata and controls
25 lines (23 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { createLogger, format, transports } from 'winston';
import * as DailyRotateFile from 'winston-daily-rotate-file';
export function initializeLogFile(filename: string) {
logger.add(new DailyRotateFile({
filename: filename,
datePattern: 'YYYY-MM-DD',
maxSize: '1m', // 1MB max size per file
maxFiles: '2d' // retain logs of the last two days
}));
}
export const logger = createLogger({
format: format.combine(
format.timestamp({
format: 'YYYY-MM-DD HH:mm:ss.SSS'
}),
format.prettyPrint()
),
transports: [
// See https://github.com/microsoft/vscode/issues/117327
// Disable console.log for lsp trace because intense logging will freeze the code render process.
// new transports.Console()
]
});