diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2022-04-04 01:13:14 +0000 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2022-04-04 01:13:14 +0000 |
| commit | a87eb1608d354a6e9c8170e0fdc432a5f556c445 (patch) | |
| tree | a36a9342bd53ce3c8df3885cc342f3b6d5f16aa4 /src/util/logger.ts | |
| parent | aa045248645094e77d529bd6d048ff83619c352e (diff) | |
| download | ao-coverage-a87eb1608d354a6e9c8170e0fdc432a5f556c445.tar.gz ao-coverage-a87eb1608d354a6e9c8170e0fdc432a5f556c445.tar.bz2 ao-coverage-a87eb1608d354a6e9c8170e0fdc432a5f556c445.zip | |
Refactor dependency on env and add comments
Diffstat (limited to 'src/util/logger.ts')
| -rw-r--r-- | src/util/logger.ts | 9 |
1 files changed, 5 insertions, 4 deletions
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; |
