robotirc

Multifonction IRC bot written in Node.js
Log | Files | Refs | README | LICENSE

commit 1fded7c3aa3852b7b34ba8ae5688bc05d5192486
parent 525cb48f3162b5125b3c573a0dae1ebd1a084feb
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date:   Mon,  6 Jan 2014 12:13:23 +0100

Adding logger (npmlog)

Diffstat:
Mlib/robotirc.js | 13++++++++++++-
Mpackage.json | 3++-
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/robotirc.js b/lib/robotirc.js @@ -23,6 +23,7 @@ var net = require('net'); var alexa = require('alexarank'); var irc = require('irc'); +var log = require('npmlog') var request = require('request'); @@ -35,10 +36,20 @@ var client = new irc.Client(config.server, config.nickname, config.options); +/**[ Connection ]*************************************************************/ + +log.info("", "RobotIRC is running. Press Ctrl+C to stop."); + +client.addListener('registered', function(message) { + log.info("", "RobotIRC is now connected to " + config.server); +}); + + + /**[ Error handler ]**********************************************************/ client.addListener('error', function(message) { - console.log('ERROR : ', message); + log.error("", message.args.splice(1, message.args.length).join(" - ")); }); diff --git a/package.json b/package.json @@ -32,6 +32,7 @@ "dependencies": { "irc": "~0.3.6", "request": "~2.30.0", - "alexarank": "~0.1.0" + "alexarank": "~0.1.0", + "npmlog": "0.0.6" } }