nutty-logfile
v0.0.3
Published
Print logs to a file using streams
Downloads
4
Maintainers
Readme
nutty-logfile
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 isutf8
.console
: print also messages in console. Default isfalse
.
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
License
MIT LICENSE © Josemi Juanes.