From 305cf97f7ee6a9638dd8521f54dc9cd5d27d2962 Mon Sep 17 00:00:00 2001 From: ppedziwiatr Date: Mon, 23 Aug 2021 10:25:27 +0200 Subject: [PATCH] feat: configurable logging --- src/logging/conf.ts | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/logging/conf.ts diff --git a/src/logging/conf.ts b/src/logging/conf.ts new file mode 100644 index 0000000..6c1d8e2 --- /dev/null +++ b/src/logging/conf.ts @@ -0,0 +1,34 @@ +import { ISettingsParam } from 'tslog/src/index'; +import { Logger } from 'tslog'; + +export const defaultLoggerOptions: ISettingsParam = { + printLogMessageInNewLine: true, + setCallerAsLoggerName: false, + displayFunctionName: false, + overwriteConsole: true, + logLevelsColors: { + '0': 'grey', + '1': 'white', + '2': 'cyan', + '3': 'blue', + '4': 'yellowBright', + '5': 'red', + '6': 'redBright' + }, + minLevel: 'debug' +}; + +export const log = { + cache: new Logger({ + ...defaultLoggerOptions + }), + client: new Logger({ + ...defaultLoggerOptions + }), + core: new Logger({ + ...defaultLoggerOptions + }), + plugins: new Logger({ + ...defaultLoggerOptions + }) +};