Add Sentry for Backend (#1403)
* - added sentry * - renamed env var * - logger driver * - add breadcrumb and category * - fix driver
This commit is contained in:
44
server/src/integrations/logger/logger.service.ts
Normal file
44
server/src/integrations/logger/logger.service.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import {
|
||||
Inject,
|
||||
Injectable,
|
||||
LoggerService as ConsoleLoggerService,
|
||||
} from '@nestjs/common';
|
||||
|
||||
import { LOGGER_DRIVER } from './logger.constants';
|
||||
|
||||
@Injectable()
|
||||
export class LoggerService implements ConsoleLoggerService {
|
||||
constructor(@Inject(LOGGER_DRIVER) private driver: ConsoleLoggerService) {}
|
||||
|
||||
log(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.log.apply(this.driver, [message, category, ...optionalParams]);
|
||||
}
|
||||
|
||||
error(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.error.apply(this.driver, [
|
||||
message,
|
||||
category,
|
||||
...optionalParams,
|
||||
]);
|
||||
}
|
||||
|
||||
warn(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.warn.apply(this.driver, [message, category, ...optionalParams]);
|
||||
}
|
||||
|
||||
debug?(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.debug?.apply(this.driver, [
|
||||
message,
|
||||
category,
|
||||
...optionalParams,
|
||||
]);
|
||||
}
|
||||
|
||||
verbose?(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.verbose?.apply(this.driver, [
|
||||
message,
|
||||
category,
|
||||
...optionalParams,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user