1.0.1 • Published 8 months ago

stratologger v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

stratologger

A simple logging middleware built on top of Winston.

Table of Contents

  1. Installation
  2. Quick Start
  3. Options
  4. Advanced Usage
  5. Contributing
  6. License

Installation

npm install stratologger

Quick 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.

1.0.1

8 months ago

1.0.0

8 months ago