Skip to content

Commit

Permalink
finish logger implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
yogurtandjam committed Aug 20, 2024
1 parent be0f87f commit 5ca2cf7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/abacus/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-disable no-console */
import type { AbacusLoggingProtocol } from '@/constants/abacus';

import { dd } from '../analytics/datadog';

class AbacusLogger implements Omit<AbacusLoggingProtocol, '__doNotUseOrImplementIt'> {
d(tag: string, message: string) {
if (
Expand All @@ -24,12 +26,14 @@ class AbacusLogger implements Omit<AbacusLoggingProtocol, '__doNotUseOrImplement
if (import.meta.env.VITE_ABACUS_LOG_LEVEL === 'debug') {
console.log(`dd info: ${message}`, context);
}
dd.info(message, context);
}

ddError(message: string, context: object) {
ddError(message: string, context: object, error: Error) {
if (import.meta.env.VITE_ABACUS_LOG_LEVEL === 'error') {
console.log(`dd error: ${message}`, context);
}
dd.error(message, context, error);
}
}

Expand Down

0 comments on commit 5ca2cf7

Please sign in to comment.