mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
Refactor logging implementation and remove console log statements
This commit is contained in:
parent
c6b47c3a1b
commit
7574d3921a
@ -21,6 +21,9 @@ export default class logger {
|
||||
LogLevel === ConfigLogLevel.DEBUG ||
|
||||
LogLevel === ConfigLogLevel.INFO
|
||||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(message);
|
||||
|
||||
this.emit({
|
||||
body: message,
|
||||
severityNumber: SeverityNumber.INFO,
|
||||
@ -35,6 +38,9 @@ export default class logger {
|
||||
LogLevel === ConfigLogLevel.WARN ||
|
||||
LogLevel === ConfigLogLevel.ERROR
|
||||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(message);
|
||||
|
||||
this.emit({
|
||||
body: message,
|
||||
severityNumber: SeverityNumber.ERROR,
|
||||
@ -48,6 +54,9 @@ export default class logger {
|
||||
LogLevel === ConfigLogLevel.INFO ||
|
||||
LogLevel === ConfigLogLevel.WARN
|
||||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(message);
|
||||
|
||||
this.emit({
|
||||
body: message,
|
||||
severityNumber: SeverityNumber.WARN,
|
||||
@ -57,6 +66,9 @@ export default class logger {
|
||||
|
||||
public static debug(message: LogBody): void {
|
||||
if (LogLevel === ConfigLogLevel.DEBUG) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug(message);
|
||||
|
||||
this.emit({
|
||||
body: message,
|
||||
severityNumber: SeverityNumber.DEBUG,
|
||||
|
@ -8,9 +8,7 @@ import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentation
|
||||
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
|
||||
import {
|
||||
BatchLogRecordProcessor,
|
||||
ConsoleLogRecordExporter,
|
||||
LoggerProvider,
|
||||
SimpleLogRecordProcessor,
|
||||
} from '@opentelemetry/sdk-logs';
|
||||
import URL from 'Common/Types/API/URL';
|
||||
import { SpanExporter } from '@opentelemetry/sdk-trace-node';
|
||||
@ -135,10 +133,6 @@ export default class Telemetry {
|
||||
);
|
||||
}
|
||||
|
||||
loggerProvider.addLogRecordProcessor(
|
||||
new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())
|
||||
);
|
||||
|
||||
logs.setGlobalLoggerProvider(loggerProvider);
|
||||
|
||||
this.logger = logs.getLogger('default');
|
||||
|
Loading…
Reference in New Issue
Block a user