本文整理匯總了TypeScript中spdlog.RotatingLogger類的典型用法代碼示例。如果您正苦於以下問題:TypeScript RotatingLogger類的具體用法?TypeScript RotatingLogger怎麽用?TypeScript RotatingLogger使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了RotatingLogger類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: createSpdLogService
export function createSpdLogService(processName: string, logLevel: LogLevel, logsFolder: string): ILogService {
try {
setAsyncMode(8192, 2000);
const logfilePath = path.join(logsFolder, `${processName}.log`);
const logger = new RotatingLogger(processName, logfilePath, 1024 * 1024 * 5, 6);
logger.setLevel(0);
return new SpdLogService(logger, logLevel);
} catch (e) {
console.error(e);
}
return new NullLogService();
}
示例2:
error(): void {
if (this.getLevel() <= LogLevel.Error) {
const arg = arguments[0];
if (arg instanceof Error) {
const array = Array.prototype.slice.call(arguments) as any[];
array[0] = arg.stack;
this.logger.error(this.format(array));
} else {
this.logger.error(this.format(arguments));
}
}
}
示例3:
flush(): void {
this.appender.flush();
}