
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@bluepic/logdna-nestjs
Advanced tools
Provides an injectable LogDNA client for logging in nestjs modules
Provides an injectable LogDNA client for logging in nestjs modules
This is a fork of @ntegral/nestjs-sentry
@bluepic/logdna-nestjs implements a module, LogDNAModule, which when imported into
your nestjs project provides a LogDNA client to any class that injects it. This
lets LogDNA be worked into your dependency injection workflow without having to
do any extra work outside of the initial setup.
npm install --save @bluepic/logdna-nestjs @logdna/logger
The simplest way to use @bluepic/logdna-nestjs is to use LogDNAModule.forRootAsync
import { Module } from '@nestjs-common';
import { LogDNAModule } from '@bluepic/logdna-nestjs';
import { ConfigModule, ConfigService } from '@nestjs/config';
@Module({
imports: [
LogDNAModule.forRootAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({
ingestionKey: configService.get('LOGDNA_INGESTION_KEY'),
logDNAOptions: {
app: 'App Name',
env: process.env.NODE_ENV,
defaultLevel: 'info',
hostname: 'Hostname',
},
}),
inject: [ConfigService],
});
],
})
export class AppModule {}
You can then inject the LogDNA client into any of your injectables by using a custom decorator
import { Injectable } from '@nestjs/common';
import { LogDNAService, InjectLogDNA } from '@bluepic/logdna-nestjs';
@Injectable()
export class AppService {
constructor(@InjectLogDNA() private readonly logger: LogDNAService) {}
testLogger() {
this.logger.log('TEST');
}
}
You can instruct Nest to use the LogDNAService as the default logger:
import { LogDNAService } from '@bluepic/logdna-nestjs';
async function bootstrap() {
const app = await NestFactory.create(AppModule, { logger: false });
app.useLogger(LogDNAService.LogDNAServiceInstance());
await app.listen(3000);
}
bootstrap();
You can use the LogDNAhttpLogger Middleware to automatically log all incoming requests/outgoing responses
import { LogDNAhttpLogger } from '@bluepic/logdna-nestjs';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(LogDNAhttpLogger({
filter: (req, res) => res.statusCode == 500
}))
await app.listen(3000);
}
bootstrap();
You can use the LogDNAhttpExceptionLogger to automatically log exceptions
import { LogDNAhttpExceptionLogger } from '@bluepic/logdna-nestjs';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalFilters(new LogDNAhttpExceptionLogger({
generateReference: true
}));
await app.listen(3000);
}
bootstrap();
Distributed under the ISC License. See LICENSE for more information.
FAQs
Provides an injectable LogDNA client for logging in nestjs modules
The npm package @bluepic/logdna-nestjs receives a total of 457 weekly downloads. As such, @bluepic/logdna-nestjs popularity was classified as not popular.
We found that @bluepic/logdna-nestjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.