1.0.1 • Published 2 years ago
stratologger v1.0.1
stratologger
A simple logging middleware built on top of Winston.
Table of Contents
Installation
npm install stratologgerQuick Start
Here's a quick example to get you started:
const express = require('express');
const createLoggerMiddleware = require('stratologger');
const app = express();
const loggerMiddleware = createLoggerMiddleware();
app.use(loggerMiddleware);
// ...Options
You can customize stratologger by passing an options object:
const options = {
level: 'info', // Logging level
infoLogPath: 'custom-info.log', // Info log file path
errorLogPath: 'custom-error.log', // Error log file path
maxFiles: '10d', // Max files to keep
maxSize: '5m' // Max log size
};
const loggerMiddleware = createLoggerMiddleware(options);Option Descriptions
level: The logging level. Default is'info'.infoLogPath: The file path for info logs. Default is'logs/application-info-%DATE%.log'.errorLogPath: The file path for error logs. Default is'logs/application-error-%DATE%.log'.maxFiles: The maximum number of log files to keep. Default is'14d'.maxSize: The maximum size of each log file. Default is'20m'.
Advanced Usage
For advanced usage scenarios, we recommend referring to Watson's Official Documentation.
Contributing
We welcome contributions from the community.
License
This package is licensed under the MIT License.