From a87eb1608d354a6e9c8170e0fdc432a5f556c445 Mon Sep 17 00:00:00 2001 From: Kevin J Hoerr Date: Mon, 4 Apr 2022 01:13:14 +0000 Subject: Refactor dependency on env and add comments --- src/util/logger.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/util/logger.ts') diff --git a/src/util/logger.ts b/src/util/logger.ts index d779718..9b0957d 100644 --- a/src/util/logger.ts +++ b/src/util/logger.ts @@ -4,8 +4,7 @@ import * as Transport from "winston-transport"; const { combine, splat, timestamp, label, colorize, printf } = winston.format; const { Console } = winston.transports; -const LOG_LEVEL = process.env.LOG_LEVEL ?? "info"; - +// Standard console message formatting const consoleFormat = combine( colorize(), printf(({ level, message, label, timestamp }) => { @@ -16,9 +15,9 @@ const consoleFormat = combine( /** * Provides standard logging format and output for the server. */ -export default ( +const loggerConfig = ( clazz: string, - level: string = LOG_LEVEL + level: string ): { format: Format; transports: Transport[]; @@ -26,3 +25,5 @@ export default ( format: combine(splat(), timestamp(), label({ label: clazz })), transports: [new Console({ level: level, format: consoleFormat })], }); + +export default loggerConfig; -- cgit