Add Sentry for Backend (#1403)

* - added sentry

* - renamed env var

* - logger driver

* - add breadcrumb and category

* - fix driver
This commit is contained in:
brendanlaschke
2023-09-11 22:22:30 +03:00
committed by GitHub
parent 110d5eaa9d
commit 35bcef5090
15 changed files with 356 additions and 0 deletions

View 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,
]);
}
}