Skip to content

willkan/onlylog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onlylog

onlylog , A pretty simple logger for Node.js

Installation

npm install onlylog

Usage

Getting start

var OnlyLog = require('onlylog')
var log = OnlyLog({
  fileName : '[test-]YYYY-MM-DD[.log]', //define log file
});
log.info('xxxx')

api

OnlyLog(options)

one of options.filename and options.stream is required

  • options

    {
      fileName : '[test-]YYYY-MM-DD[.log]', //define log file
      allLevels : ['info', 'debug', 'warn', 'error'], //define api name
      logLevels : ['info'], //define the level need to write to file
      duration : 5000, // flush buffer time, default is 2000
      bufferLength : 1000, // max buffer length, default is 0
      format: // custom format function
        function (level) {
          return function () {
            return arguments.toString()
          }
        },
      stream: process.stdout, // use stream instead of default file ouput
      rotation: 7 // 日志默认保留7天
    }

About

simple log for node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published