Skip to content

esenadindar/winston-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Winston Logger Config A comprehensive Winston logging configuration with HTTP request logging and performance monitoring. ## Features - Daily rotating file logs - HTTP request logging - Performance monitoring - Error tracking - Custom log levels - Color-coded console output - Log file compression - Automatic log rotation ## Installation ```bash npm install winston-logger-config ``` ## Usage ### Basic Setup ```javascript const { logger, requestLogger } = require('winston-logger-config'); const express = require('express'); const app = express(); // Use the request logger middleware app.use(requestLogger); // Example usage app.get('/', (req, res) => { logger.info('Home page accessed'); res.send('Hello World!'); }); ``` ### Custom Configuration ```javascript const { createLogger } = require('winston-logger-config'); // Create a custom logger instance const customLogger = createLogger({ // Add your custom options here logDirectory: './custom-logs', maxFileSize: '10m', maxFiles: '7d' }); ``` ## Log Levels The logger supports the following log levels: - `error`: For error messages - `warn`: For warning messages - `info`: For general information - `http`: For HTTP request logs - `debug`: For debug information - `performance`: For performance-related logs ## Log Files The following log files are created: - `error-*.log`: Error-level logs - `http-*.log`: HTTP request logs - `performance-*.log`: Performance-related logs - `combined-*.log`: All logs combined ## Configuration Default configuration: - Daily log rotation - 20MB max file size - 14 days retention - Compressed archives - Color-coded console output ## License MIT # winston-log

About

USM-022 : Winston veya Pino kullanılarak loglama mekanizmasının oluşturulması.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published