I have an Angular 5 application with error logging using sentry.io which uses raven.js.
I have this all working correctly but do not want to log errors when running in development. How do I only enable error logging when production mode is enabled?
I have the following in my app.module.ts
import * as Raven from 'raven-js';
Raven
.config('https://[email protected]/xxx')
.install();
export class RavenErrorHandler implements ErrorHandler {
handleError(err: any): void {
Raven.captureException(err);
}
}
If you are using angular-cli, they have environment files you can simply do
if (environment.production) { ... }