Skip to content

Commit be57e59

Browse files
committed
Adjust logger to stop console logging in Production environment; informational comments added accordingly.
1 parent 5cd64aa commit be57e59

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: logger.config.mjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import { logToSentry } from './sentry.client.config.mjs';
33

44
export const configureLogger = () => {
55
if (process.env.NODE_ENV === 'production') {
6-
log.setLevel('error');
6+
// In production, we want to log only to Sentry
7+
log.setLevel('silent');
78

8-
const originalErrorMethod = log.error;
99
log.error = (...args) => {
10-
originalErrorMethod(...args); // log the error to the console
11-
logToSentry(args.join(' ')); // send the error to Sentry
10+
logToSentry(args.join(' '));
1211
};
1312

1413
} else if (process.env.NODE_ENV === 'development') {
14+
// In development, we want to log only to the console
1515
log.setLevel('info');
1616
}
1717
};

0 commit comments

Comments
 (0)