aboutsummaryrefslogtreecommitdiff
path: root/src/util/logger.ts
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2022-04-04 01:13:14 +0000
committerKevin J Hoerr <kjhoerr@protonmail.com>2022-04-04 01:13:14 +0000
commita87eb1608d354a6e9c8170e0fdc432a5f556c445 (patch)
treea36a9342bd53ce3c8df3885cc342f3b6d5f16aa4 /src/util/logger.ts
parentaa045248645094e77d529bd6d048ff83619c352e (diff)
downloadao-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.ts9
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;