Long Term Food Storage Will Maintain Your Life

Are you wondering what the differences are between freeze dried foods and dehydrated foods? There are of differences. First of all, the processes used to preserve the food and stop spoilage and…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Error Logging NestJS with Sentry

A tutorial on how to handle errors and logging with Sentry

Logging errors in a project is essential for several reasons:

Sentry is commonly used for logging because it is a powerful and flexible error tracking and monitoring platform. While logging frameworks like Log4j or Python’s logging module provide basic logging capabilities, Sentry goes beyond traditional logging by providing additional features specifically designed for error tracking and monitoring in software applications.

Before we go so far, let’s prepare some software and account we need.

Software

Account

Install NestJS CLI globally:

Create a new project and test it:

The output will be like this:

Make sure you have the necessary packages installed. Install the following packages using npm or yarn:

Init sentry at your main.ts (src/main.ts) and update your sentry dsn url

Add SentryInterceptor as provider at AppModule (src/app.module.ts) to make all controller can access SentryInterceptor

Add UseInterceptors with SentryInterceptor at AppController (src/app.controller.ts) and test throwing error at some function

Access localhost:3000 and we will receive Sentry notification

sentry error logging
detail sentry error logging

Today we have learned how to create logging for errors in a NestJS project with Sentry. Stay on top of several other news, let’s connect via LinkedIn!

Add a comment

Related posts:

All The Stereotypes

I saw it while walking out from the grocery store. A red pickup truck lifted up so it would tower over all the other puny vehicles around it. If you look carefully you can see my truck on the left…

Winning Guild Members and Methods to claim rewards

During the 4-day LOA Guild Tournament, 210 members from 21 guilds, which were voted out of 41 guilds by 1,471 community members, experienced the fun of various game modes such as Arena Leaderboard…

In Depth Guide To Lead Enrichment APIs For Obtaining The Best Results

Do you wish to read a depth guide to lead enrichment APIs for obtaining the best results? Well, you have come to the right article, because here we have prepared for you the right piece of…