mirror of
https://github.com/reality/dbot.git
synced 2024-12-28 05:32:50 +01:00
Logging modules added (requires jsbot support for multi-listeners).
This commit is contained in:
parent
acb427a24e
commit
9d5cf694a8
41
modules/logging.js
Normal file
41
modules/logging.js
Normal file
@ -0,0 +1,41 @@
|
||||
var logging = function(dbot) {
|
||||
var logMessage = function(message) {
|
||||
if(!(dbot.hasOwnProperty('log'))) {
|
||||
dbot['log'] = [];
|
||||
}
|
||||
dbot.log.push([Date.now(), message]);
|
||||
};
|
||||
|
||||
return {
|
||||
'onLoad': function() {
|
||||
logMessage({
|
||||
'type': 'LoggerEvent',
|
||||
'details': 'Logger loaded.'
|
||||
});
|
||||
|
||||
return {};
|
||||
},
|
||||
|
||||
'onDestroy': function() {
|
||||
logMessage({
|
||||
'type': 'LoggerEvent',
|
||||
'details': 'Logger unloaded.'
|
||||
});
|
||||
},
|
||||
|
||||
'listener': function(data, eventType) {
|
||||
logMessage({
|
||||
'type': 'IRCEvent',
|
||||
'details': {
|
||||
'eventType': eventType,
|
||||
'data': data
|
||||
}
|
||||
});
|
||||
},
|
||||
'on': ['JOIN', 'PART', 'KICK', 'PRIVMSG', 'MODE']
|
||||
};
|
||||
};
|
||||
|
||||
exports.fetch = function(dbot) {
|
||||
return logging(dbot);
|
||||
};
|
Loading…
Reference in New Issue
Block a user