diff --git a/src/constants/configs.ts b/src/constants/configs.ts index 9ea24ef3..4ab657f6 100644 --- a/src/constants/configs.ts +++ b/src/constants/configs.ts @@ -3,4 +3,7 @@ export const MAX_CLASS_PATH_LENGTH: number = 4096; export const CHILD_PROCESS_MAX_BUFFER_SIZE: number = 1024 * 1024; +export const LOG_FILE_LEVEL: string = 'info'; export const LOG_FILE_NAME: string = 'java_test_runner.log'; +export const LOG_FILE_MAX_SIZE: number = 5 * 1024 * 1024; +export const LOG_FILE_MAX_NUMBER: number = 2; diff --git a/src/logger/logger.ts b/src/logger/logger.ts index a3fc8a11..cd34c247 100644 --- a/src/logger/logger.ts +++ b/src/logger/logger.ts @@ -4,7 +4,7 @@ import * as path from 'path'; import { Disposable } from 'vscode'; import * as winston from 'winston'; -import { LOG_FILE_NAME } from '../constants/configs'; +import { LOG_FILE_LEVEL, LOG_FILE_MAX_NUMBER, LOG_FILE_MAX_SIZE, LOG_FILE_NAME } from '../constants/configs'; import { outputChannelTransport } from './outputChannelTransport'; class Logger implements Disposable { @@ -15,7 +15,13 @@ class Logger implements Disposable { this.storagePath = storagePath; this.logger = winston.createLogger({ transports: [ - new (winston.transports.File)({level: 'info', filename: path.join(this.storagePath, LOG_FILE_NAME), maxsize: 5 * 1024 * 1024, maxFiles: 2, tailable: true}), + new (winston.transports.File)({ + level: LOG_FILE_LEVEL, + filename: path.join(this.storagePath, LOG_FILE_NAME), + maxsize: LOG_FILE_MAX_SIZE, + maxFiles: LOG_FILE_MAX_NUMBER, + tailable: true, + }), outputChannelTransport, ], });