Star us on GitHub
Star
Menu

Logging in Nest.js

Learn how to set up highlight.io log ingestion in Nest.js.

1

Set up your frontend highlight.io integration.

First, make sure you've followed the frontend getting started guide.

2

Add the @highlight-run/nest app middleware.

Use the HighlightLogger middleware to record backend logs in highlight.io

import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { HighlightInterceptor, H } from '@highlight-run/nest'; const env = { projectID: '<YOUR_PROJECT_ID>', serviceName: 'my-nestjs-app', serviceVersion: 'git-sha', environment: 'production', debug: false, }; async function bootstrap() { H.init(env); const app = await NestFactory.create(AppModule); app.useGlobalInterceptors(new HighlightInterceptor(env)); await app.listen(3000); } bootstrap();
Copy
3

Verify your backend logs are being recorded.

Visit the highlight logs portal and check that backend logs are coming in.