Skip to content

Commit

Permalink
Refactor logger constructor to use environment variable for log level
Browse files Browse the repository at this point in the history
  • Loading branch information
MXPOL committed Feb 11, 2024
1 parent d563c65 commit 5468520
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/external-db-logger/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export class Logger implements ILogger {
private logLevel: LogLevel
private logger: pino.Logger

constructor(level = LogLevel.DEBUG) {
this.logLevel = level
constructor() {
this.logLevel = process.env['LOG_LEVEL']?.toLocaleLowerCase() as LogLevel || LogLevel.WARN
this.logger = pino({
base: {},
timestamp: false,
level,
level: this.logLevel,
messageKey: 'message',
formatters: {
level: (label) => ({
Expand Down

0 comments on commit 5468520

Please sign in to comment.