nestjs-email-logger
v1.0.6
Published
Log nest-js errors by sending emails
Downloads
13
Readme
Nest.js email logger
Installation
npm install nestjs-email-logger
or
yarn add nestjs-email-logger
Configuration
You will need to import the following modules in the main.js file:
import { NotFoundExceptionFilter, LoggerInterceptor } from 'nestjs-email-logger';
And after that you have to configure your app to use those modules globally. Receivers and sender are optional arrays.
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalInterceptors(new LoggerInterceptor("Project Name", [receivers], sender));
app.useGlobalFilters(new NotFoundExceptionFilter("Project Name", [receivers], sender));
await app.listen(process.env.PORT || 3000);
}
Finally, you will need to set the following env variables with your SendGrid API key:
SG_API_KEY="YOUR_API_KEY"
If you are in DEV environment and you do not want to send emails, you can set the following env variable:
PREVENT_EMAIL_SEND="true"