Skip to content

lemon-sour/node-log-rotate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ebf629e Β· May 5, 2020

History

65 Commits
Apr 29, 2020
Apr 29, 2020
May 5, 2020
May 5, 2020
May 5, 2020
Feb 10, 2019
Jan 27, 2019
Dec 12, 2018
Apr 29, 2020
May 5, 2020
May 5, 2020
Dec 14, 2018
Feb 24, 2020
Mar 14, 2019
May 5, 2020
Apr 29, 2020
Jan 27, 2019
Jan 27, 2019
May 5, 2020

Repository files navigation

πŸ’„ node-log-rotate πŸ’„

Downloads Version License PRs Welcome

Description

inspire:

megahertz/electron-log: Just a very simple logging module for your Electron application

Just a very simple logging module for your node.js application. No dependencies. No complicated configuration. Just require and use.

By default it writes logs to the following locations:

  • on Linux: ~/.config/<app name>/<date+time>log.log
  • on OS X: ~/Library/Logs/<app name>/<date+time>log.log
  • on Windows: $HOME/AppData/Roaming/<app name>/<date+time>log.log

Installation

Install with npm:

npm install node-log-rotate

or

Yarn

yarn add node-log-rotate

Usage

Basic usage

Name of the directory get from process.env.npm_package_name.

import { log } from 'node-log-rotate';

log('Hello, log');

ES2015

import { setup, log } from 'node-log-rotate';
setup({
  appName: 'project-name',  // If you want to specify the project name, you can specify it.
  maxSize: 10 * 1024 * 1024
});

log('Hello, log');

CommonJS

var log = require('node-log-rotate');
log.setup({
  appName: 'project-name',   // If you want to specify the project name, you can specify it.
  maxSize: 10 * 1024 * 1024
});

log.log('Hello, log');

About deleting log files

For this sample, log files before 10 days ago will be deleted.

import { setup, deleteLog } from 'node-log-rotate';
setup({
  appName: 'project-name'  // If you want to specify the project name, you can specify it.
});

deleteLog(10);

Author

License

MIT Β© hisasann (Yoshiyuki Hisamatsu)