You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`status`| If any health indicator failed the status will be `'error'`. If the NestJS app is shutting down but still accepting HTTP requests, the health check will have the `'shutting_down'` status. |`'error' \| 'ok' \| 'shutting_down'`|
163
163
|`info`| Object containing information of each health indicator which is of status `'up'`, or in other words "healthy". |`object`|
164
164
|`error`| Object containing information of each health indicator which is of status `'down'`, or in other words "unhealthy". |`object`|
@@ -525,6 +525,88 @@ export class HealthController {
525
525
}
526
526
```
527
527
528
+
#### Logging
529
+
530
+
Terminus only logs error messages, for instance when a Healthcheck has failed. With the `TerminusModule.forRoot()` method you have more control over how errors are being logged
531
+
as well as completely take over the logging itself.
532
+
533
+
In this section, we are going to walk you through how you create a custom logger `TerminusLogger`. This logger extends the built-in logger.
534
+
Therefore you can pick and choose which part of the logger you would like to overwrite
535
+
536
+
> info **Info** If you want to learn more about custom loggers in NestJS, [read more here](/techniques/logger#injecting-a-custom-logger).
|`json` (default) | Prints a summary of the health check result in case of an error as JSON object | <figure><imgsrc="/assets/Terminus_Error_Log_Json.png" /></figure> |
594
+
|`pretty`| Prints a summary of the health check result in case of an error within formatted boxes and highlights successful/erroneous results | <figure><imgsrc="/assets/Terminus_Error_Log_Pretty.png" /></figure> |
595
+
596
+
You can change the log style using the `errorLogStyle` configuration option as in the following snippet.
597
+
598
+
```typescript
599
+
@@filename(health.module)
600
+
@Module({
601
+
imports: [
602
+
TerminusModule.forRoot({
603
+
errorLogStyle: 'pretty',
604
+
}),
605
+
]
606
+
})
607
+
exportclassHealthModule {}
608
+
```
609
+
528
610
#### More examples
529
611
530
612
More working examples are available [here](https://github.com/nestjs/terminus/tree/master/sample).
0 commit comments