logobj

Object to File Logger for Node
Install
npm install logobj
Usage
logobj([<filename>,] <data> [, <options>]);
var logobj = require('logobj');
logobj(data);
logobj('myfile.json', data);
logobj('myfile.json', data, options);
Parameters
filename (optional)
- Name of file to write data to.
- Date/time will be appended to the name before the extension. (Can be disabled - see options below)
- If not specified then a UUID will be used with the dashes removed and '.json' appended.
data
- The data that you want to write to the file.
- If it's not an object then it will be encapsulated inside an object.
- The data will be pretty printed (also called beautified or beautification).
options (optional)
The default options are show below with comments.
{
filename: {
nodate: false,
dateFormat: 'YYYYMMDDhhmmss',
leadDate: false,
appendJson: false
},
indent: 2,
serializer: null,
fsOptions: {
encoding: 'utf8'
}
}