🧹 Clean up logger utility by removing extra whitespace and simplifying arrow function syntax

This commit is contained in:
2026-01-29 13:19:05 +00:00
parent 2327557764
commit ee24b9bffc

View File

@@ -1,6 +1,6 @@
/**
* Production Logger with Winston
*
*
* Provides structured logging for development and production environments.
* - Console logging for development with colors
* - File logging for production with rotation
@@ -71,7 +71,7 @@ if (isProduction) {
maxFiles: 5
})
);
// Error logs
logger.add(
new winston.transports.File({
@@ -88,7 +88,7 @@ if (isProduction) {
*/
export function requestLogger(req, res, next) {
const start = Date.now();
// Log request
logger.info('HTTP Request', {
method: req.method,
@@ -96,12 +96,12 @@ export function requestLogger(req, res, next) {
ip: req.ip,
userAgent: req.get('user-agent')
});
// Log response when finished
res.on('finish', () => {
const duration = Date.now() - start;
const logLevel = res.statusCode >= 400 ? 'warn' : 'info';
logger[logLevel]('HTTP Response', {
method: req.method,
url: req.url,
@@ -109,7 +109,7 @@ export function requestLogger(req, res, next) {
duration: `${duration}ms`
});
});
next();
}
@@ -124,14 +124,14 @@ export function errorLogger(err, req, res, next) {
url: req.url,
body: req.body
});
next(err);
}
/**
* Log uncaught exceptions and unhandled rejections
*/
process.on('uncaughtException', (error) => {
process.on('uncaughtException', error => {
logger.error('Uncaught Exception', {
error: error.message,
stack: error.stack