Comments (6)
import { Injectable } from '@nestjs/common';
import { InjectSentry, SentryService } from '@ntegral/nestjs-sentry';
@Injectable()
export class AppService {
public constructor(@InjectSentry() private readonly client: SentryService) {
client.instance().captureMessage(message, Sentry.Severity.Log);
client.instance().captureException(exception);
... and more
}
}
from nestjs-sentry.
@MatthewHerbst - To enable logging across the entire app you can do the following:
async function bootstrap() {
const app = await NestFactory.create(AppModule, {
logger: SentryService.SentryServiceInstance(),
});
or // app.useLogger(app.get(SentryService)); // either or will turn on logging at the application level.
await app.listen(3000);
}
bootstrap();
Note: this package extends NestJS logging. Please see the NestJS documentation of application logging for details. Thanks.
https://docs.nestjs.com/techniques/logger
from nestjs-sentry.
Sorry, I know you said without interceptors, but so far I figured: you need to add interceptor in order for Sentry to receive any exceptions raised from any end-point. Example:
imports: [
SentryModule.forRoot({
dsn: 'dsn_here',
debug: true,
environment: 'production',
release: null, // must create a release in sentry.io dashboard
logLevel: LogLevel.Debug, //based on sentry.io loglevel //
tracesSampleRate: 1.0,
close: {
enabled: true,
timeout: 1000
},
}),
ConfigModule.forRoot(),
HttpModule,
],
controllers: [AppController],
providers: [
AppService,
{
provide: APP_INTERCEPTOR,
useValue: new SentryInterceptor()
}
]
What I can't figure out so far, is: how to get console.log('example')
to be sent to Sentry.
from nestjs-sentry.
@meirka did you figure this out?
@ntegral the goal here is to enable Sentry across the entire app without having to inject it into every injectable.
from nestjs-sentry.
Hey @MatthewHerbst
No, I haven't figured out how to automagically get console.log(..)
to be sent to Sentry.
from nestjs-sentry.
@ntegral thank you!
from nestjs-sentry.
Related Issues (20)
- Custom exception does not work in SentryInterceptor HOT 4
- Sentry Profiling Integration doesn't work HOT 8
- Exception objectError does not work
- unmet peer rimraf@^3.0.2: found 4.1.2
- Make app name in sentryService customizable HOT 1
- Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'
- Is this project still maintained? HOT 7
- nestjs 10 support HOT 5
- Getting error in the latest version of nestjs (v10) HOT 6
- Remove 'rimraf' unused dependency HOT 1
- Request for Updating 'reflect-metadata' Package Version in Project HOT 2
- Question: Is there way to access Sentry directly in app.ts
- Stacktraces don't show the relevant stack HOT 1
- mocking sentry injection HOT 1
- NestJs 9 Support HOT 7
- How to inject into another module? HOT 4
- Why does my Sentry errors look like this? HOT 1
- Add Performance Tracking HOT 3
- Integrate Sentry Prisma ORM HOT 2
- Update imports of `@sentry/hub` to use `@sentry/core`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nestjs-sentry.