
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@opengeekslab_llc/nest-custom-logger
Advanced tools
Provides logger and request middleware for NestJS and express application.
{"type":"http","context":"Request","message":"::ffff:192.168.88.107 - POST /auth/signin - 400 [Bad Request] (0b sent in 21 ms)","requestData":{"clientIp":"::ffff:192.168.88.107","method":"POST","originalUrl":"/auth/signin","statusCode":400,"statusMessage":"Bad Request","contentSize":0,"responseTime":21}}
import { Logger } from '@opengeekslab_llc/nest-custom-logger';
const logger = new (Logger(!process.env.NODE_ENV))('Hello');
logger.log('World')
function CustomLogger(context: string) {
return new (Logger(!process.env.NODE_ENV))(context);
}
class Test {
logger = CustomLogger('Test');
run() {
this.logger.log('log');
this.logger.error('error');
}
}
const { Logger } = require('@opengeekslab_llc/nest-custom-logger');
const logger = new (Logger(!process.env.NODE_ENV))('Hello');
logger.log('World')
const express = require('express');
const { requestLoggerMiddleware } = require('@opengeekslab_llc/nest-custom-logger');
const app = express();
const requestWriteLogs = CustomLogger('Request');
const requestLogger = requestLoggerMiddleware({
writeLog: requestWriteLogs.http,
});
app.use(requestLogger);
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { CustomLogger, requestLogger } from '@opengeekslab_llc/nest-custom-logger';
const port = 8000;
async function bootstrap() {
const logger = CustomLogger('NEST');
const app = await NestFactory.create(AppModule, {
logger,
});
// use this middleware to show http logs in your console
app.use(requestLogger);
await app.listen(port);
logger.log(`app is listening on port ${port}`);
}
bootstrap();
FAQs
Logger that prints to output json logs
The npm package @opengeekslab_llc/nest-custom-logger receives a total of 7 weekly downloads. As such, @opengeekslab_llc/nest-custom-logger popularity was classified as not popular.
We found that @opengeekslab_llc/nest-custom-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.