0.1.2 • Published 7 years ago

simple-logrotate v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

simple-logrotate

Rotate and compress log files or directories for your node application on app start.

Copyright (C) 2017 Larry Price <larry.price.dev@gmail.com>. See LICENSE for more details.

Usage

The rotate function takes in two parameters, logname and backups, and returns a promise:

const logRotate = require('simple-logrotate')

// input parameters
const logname = '/tmp/myapp'; // Path to the original log file or directory
const backups = 3;            // Number of compressed backup logs to keep

logRotate(logname, backups).then(() => {
  // insert your main logic here
}, (err) => {
  // handle internal error
  console.error(err);
});

The backup files will be named as ${logname}.x.tar.gz, where x is an integer between 1 and backups. On rotation, the log corresponding with the integer x will be removed.

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago