
Research
/Security News
npm Package Uses Prompt Injection and Token Flooding to Disrupt AI Malware Scanners
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.
@edirect/logger
Advanced tools
Structured logging module for eDirect NestJS applications. Built on top of [Pino](https://github.com/pinojs/pino), providing high-performance JSON logging with AsyncLocalStorage support for automatic context propagation, file output, and seamless integrat
Structured logging module for eDirect NestJS applications. Built on top of Pino, providing high-performance JSON logging with AsyncLocalStorage support for automatic context propagation, file output, and seamless integration with NestJS.
pnpm add @edirect/logger
# or
npm install @edirect/logger
import { Module } from '@nestjs/common';
import { LoggerModule } from '@edirect/logger';
@Module({
imports: [LoggerModule],
})
export class AppModule {}
import { Injectable } from '@nestjs/common';
import { LoggerService } from '@edirect/logger';
@Injectable()
export class MyService {
constructor(private logger: LoggerService) {}
doSomething() {
this.logger.info('Operation started', { userId: '123' });
}
}
If you want automatic context extraction from HTTP headers, add the middleware:
import { Module, MiddlewareConsumer, NestModule } from '@nestjs/common';
import { LoggerModule, LoggerContextMiddleware } from '@edirect/logger';
@Module({
imports: [LoggerModule],
})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
consumer
.apply(LoggerContextMiddleware)
.forRoutes('*'); // Apply to all routes
}
}
import { Injectable } from '@nestjs/common';
import { LoggerService } from '@edirect/logger';
@Injectable()
export class MyService {
constructor(private logger: LoggerService) {}
doSomething() {
this.logger.info('Operation started', { userId: '123' });
// sessionId and quoteId automatically included from request context!
}
}
import { Module } from '@nestjs/common';
import { LoggerModule } from '@edirect/logger';
@Module({
imports: [
LoggerModule.register({
output: 'console', // 'console' | 'file' | 'both'
level: 'info',
logs: {
infoFile: './logs/info.log',
warningFile: './logs/warning.log',
errorFile: './logs/error.log',
exceptionsFile: './logs/exceptions.log',
},
name: 'my-service',
version: '1.0.0',
}),
],
})
export class AppModule {}
import { ConfigService } from '@edirect/config';
import { LoggerModule } from '@edirect/logger';
@Module({
imports: [
ConfigModule,
LoggerModule.registerAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({
output: configService.get('LOGS_OUTPUT'),
level: configService.get('LOGS_LEVEL'),
logs: {
infoFile: configService.get('LOGS_INFO_FILE'),
warningFile: configService.get('LOGS_WARNING_FILE'),
errorFile: configService.get('LOGS_ERROR_FILE'),
exceptionsFile: configService.get('LOGS_EXCEPTIONS_FILE'),
},
name: configService.get('APP_NAME'),
version: configService.get('APP_VERSION'),
}),
inject: [ConfigService],
}),
],
})
export class AppModule {}
// Info logging
logger.log(message: string, payload?: any);
logger.info(message: string, payload?: any);
// Warning logging
logger.warn(message: string, payload?: any);
// Debug logging
logger.debug(message: string, payload?: any);
logger.verbose(message: string, payload?: any);
// Error logging (multiple overloads)
logger.error(message: string); // Just message
logger.error(message: string, payload: any); // Message + payload to enrich
logger.error(message: string, trace: string); // Message + stack trace
logger.error(message: string, error: Error); // Message + Error object
logger.error(message: string, payload: any, trace: string); // Full context
// Set context manually (useful for background jobs)
logger.setContext('sessionId', 'session-123');
logger.setContext('quoteId', 'quote-456');
logger.setContext('correlationId', 'corr-789');
logger.setContext('traceId', 'trace-abc');
logger.setContext('userId', 'user-xyz');
import { AsyncContextManager } from '@edirect/logger';
@Cron('0 0 * * *')
handleCron() {
AsyncContextManager.run({ sessionId: 'cron-job', quoteId: 'batch-001' }, () => {
this.logger.info('Cron job started');
// Context automatically propagates through all async calls
});
}
The LoggerContextMiddleware automatically extracts context from these HTTP headers:
x-session-id → sessionIdx-quote-id → quoteIdx-trace-id → traceIdx-correlation-id → correlationIdreq.user.id → userIdAll logs are structured JSON with the following fields:
{
"timestamp": "2024-03-06T14:30:00.123Z",
"level": "info",
"message": "Operation completed",
"name": "my-service",
"version": "1.0.0",
"host": "localhost",
"protocol": "http",
"sessionId": "session-123",
"quoteId": "quote-456",
"correlationId": "corr-789",
"traceId": "trace-abc",
"userId": "user-xyz",
"remote-address": "192.168.1.1",
"details": { "custom": "data" },
"trace": "Error stack trace" // Only in error logs
}
// Simple error
logger.error('Something went wrong');
// Error with enrichment details
logger.error('User not found', { userId: '123', action: 'login' });
// Error with stack trace
logger.error('Database error', 'Error: Connection timeout\n at db.connect...');
// Error with Error object (auto-extracts stack)
try {
throw new Error('Failed to process');
} catch (error) {
logger.error('Processing failed', error);
}
// Full context error
logger.error(
'Complex error',
{ context: 'payment', orderId: '456' },
'Error stack trace here'
);
MIT
FAQs
Structured logging module for eDirect NestJS applications. Built on top of [Pino](https://github.com/pinojs/pino), providing high-performance JSON logging with AsyncLocalStorage support for automatic context propagation, file output, and seamless integrat
The npm package @edirect/logger receives a total of 175 weekly downloads. As such, @edirect/logger popularity was classified as not popular.
We found that @edirect/logger demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 29 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.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.

Product
Socket now detects supply chain risks in project manifests, starting with missing lockfiles that can make dependency installs non-reproducible.

Research
/Security News
The trojanized extensions use TinyGo-compiled WebAssembly and Solana transaction memos to resolve command-and-control infrastructure.