0.0.3 • Published 8 years ago

nutty-logfile v0.0.3

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

nutty-logfile

npm npm npm

Print logs to a file using streams

Installation

npm install --save nutty-logfile

API

Initialize the module in your project:

var logfile = require('nutty-logfile');

var file = new logfile(path, options)

Returns a new logfile object to print log messages to a file placed in path. The optionally options argument must be an object with the following keys:

  • encoding: encoding. Default is utf8.
  • console: print also messages in console. Default is false.
var file = new logfile('/path/to/my/file.log');

file.(message)

Prints a log message with the specified level. See the supported levels list.

//Print a notice message to the file
file.notice('This is a notice message'); // Will print: [2017/01/30 11:02:33] [NOTICE] This is a notice message

file.end()

Closes the stream file.

Related

  • nutty A small and minimal CLI framework.
  • nutty-log Logger for cli apps and nutty middlewares

License

MIT LICENSE © Josemi Juanes.