-
-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathnest-logger.ts
33 lines (26 loc) · 936 Bytes
/
nest-logger.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { LoggerService } from '@nestjs/common';
import { Logger } from './logger';
import { LoggerOptions } from './interfaces/logger-options.interface';
import { Cache, LOGGER } from '@nestcloud/common';
export class NestLogger implements LoggerService {
private readonly logger;
constructor(options: LoggerOptions) {
this.logger = new Logger(options).getLogger();
Cache.getInstance(LOGGER).set('logger', this.logger);
}
error(message: any, trace?: string, context?: string): any {
this.logger.error(message, trace);
}
log(message: any, context?: string): any {
this.logger.info(message);
}
warn(message: any, context?: string): any {
this.logger.warn(message);
}
debug(message: any, context?: string): any {
this.logger.debug(message);
}
verbose(message: any, context?: string): any {
this.logger.verbose(message);
}
}