Skip to content

Commit

Permalink
Merge pull request #3567 from johnbiundo/biundo/logger
Browse files Browse the repository at this point in the history
feat(logger): add setContext method
  • Loading branch information
kamilmysliwiec committed Dec 8, 2019
2 parents ee9a0bf + b087a67 commit a959ce0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/common/services/logger.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class Logger implements LoggerService {
private static instance?: typeof Logger | LoggerService = Logger;

constructor(
@Optional() protected readonly context?: string,
@Optional() protected context?: string,
@Optional() private readonly isTimestampEnabled = false,
) {}

Expand Down Expand Up @@ -58,6 +58,10 @@ export class Logger implements LoggerService {
this.callFunction('verbose', message, context);
}

setContext(context: string) {
this.context = context;
}

static overrideLogger(logger: LoggerService | LogLevel[] | boolean) {
if (Array.isArray(logger)) {
this.logLevels = logger;
Expand Down

0 comments on commit a959ce0

Please sign in to comment.