1.0.13 • Published 5 years ago

wow-logger v1.0.13

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

wow-logger

Node.JS simplistic logger that auto rotates logs

Wow logger was designed with the intention of making it extremely easy to log content from a NodeJS app with the feature of auto rotating files.

Why wow logger

  1. Its extremely light
  2. Minimal configurations
  3. Gets work done
  4. Easy to get started

Installation

$ npm install wow-logger

Options

  • output: Specifies where to put the logs. Accepts console and file to either output to console or file respectively. Default is file.
  • levels: Specifies the levels array in which to classify the logs in, these are not restricted to any values but only alpha characters allowed. Default is [].
  • timestamp: Whether or not to include timestamp in the logs. Default is true;
  • autorotate: Specifies the frequency in which to rotate logs. Accepts hourly, daily, none. If none is specified, no logs will still be saved in the display name date format but will not be folderised. Default is hourly.
  • dirDateFormat This sets the date format for which to be used to name the folders when rotating logs. Accepts same formatting options as moment but only for date, month and year (DMY) and separators (-_., \/). Default is DD-MMMM-YYYY.
  • dateFormat This sets the date format for naming the log files. Accepts same formatting options as moment. All log files have extension .log. When level specified e.g. error, log file will be 12-December-2018_error.log or 12-December-2018.log if level not specified. Default is DD-MMMM-YYYYTHH.
  • dir This sets the location in which to store the logs (files or folders). Default is ..

Usage

const logger = require('wow-logger');
const path = require('path');

const log = logger({
    output: 'file',
    levels: [
        'error',
        'warning',
        'info'
    ],
    timestamp: true,
    autorotate: 'hourly',
    dirDateFormat: 'DD-MMMM-YYYY',
    dateFormat: 'DD-MMMM-YYYYTHH',
    dir: path.resolve(__dirname, 'logs')
});

log('Hello wow logger with level', 'info'); //NB: If this level is not specified in levels option then it will be discarded

log('Hello wow logger without level');

LICENCE

MIT

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0-beta.1

5 years ago

0.1.0-beta.o

5 years ago