kad-logger-json v0.1.2
Kad JSON Logger
Streaming logger for Kad as newline-separated JSON.
Quick Start
Install with NPM:
npm install kad-logger-json --save
Pass your logger to Kad:
// Import dependencies
var Node = require('kad').Node;
var JSONLogger = require('kad-logger-json');
// Create your logger
var logger = new JSONLogger();
// Plugin to your kad node
var node = new Node({
/* ... */
logger: logger
});
Pipe the log output to any writable stream:
// Make the logs your program's output
logger.pipe(process.stdout);
// Write the logs to a file
logger.pipe(fs.createWriteStream('logfile.txt'));
License
kad-logger-json - Streaming logger for Kad as newline-separated JSON. Copyright (C) 2016 Gordon Hall
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this program. If not, see http://www.gnu.org/licenses/.