Skip to content

Commit cdb6544

Browse files
authored
docs(nestjs): Add logs flag to setup and add custom logging integration page (#15668)
I noticed that toggling the logs feature in nestjs docs didn't add the `enableLogs` flag. I also added a feature page that explains how to get Sentry logs for the default nestjs logger.
1 parent fc78960 commit cdb6544

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: NestJS Logging
3+
description: "Learn about integrating Sentry with NestJS logging."
4+
---
5+
6+
To integrate Sentry logs in your NestJS application, follow the general [logs setup guide](/platforms/javascript/guides/nestjs/logs/).
7+
8+
## Using the Default NestJS Logger
9+
10+
The default NestJS logger uses `console.log` under the hood. If you're using the default logger, you can use the [`consoleLoggingIntegration`](/platforms/javascript/guides/nestjs/logs/#console-logging-integration) to capture console logs.
11+
12+
Note that this only works if you set the `forceConsole` option in the logger:
13+
14+
```typescript
15+
const app = await NestFactory.create(AppModule, {
16+
logger: new ConsoleLogger({
17+
forceConsole: true,
18+
})
19+
});
20+
```

platform-includes/getting-started-config/javascript.nestjs.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,10 @@ Sentry.init({
3131
// https://docs.sentry.io/platforms/javascript/guides/nestjs/configuration/options/#profilesSampleRate
3232
profilesSampleRate: 1.0,
3333
// ___PRODUCT_OPTION_END___ profiling
34+
// ___PRODUCT_OPTION_START___ logs
35+
36+
// Enable logs to be sent to Sentry
37+
enableLogs: true,
38+
// ___PRODUCT_OPTION_END___ logs
3439
});
3540
```

0 commit comments

Comments
 (0)