Merge pull request #783 from thelounge/xpaw/irc-raw-log
Option to log raw IRC traffic
This commit is contained in:
commit
df4b14d546
@ -361,11 +361,24 @@ module.exports = {
|
|||||||
primaryKey: "uid"
|
primaryKey: "uid"
|
||||||
},
|
},
|
||||||
|
|
||||||
// Enables extra debugging output. Turn this on if you experience
|
// Extra debugging
|
||||||
// IRC connection issues and want to file a bug report.
|
//
|
||||||
|
// @type object
|
||||||
|
// @default {}
|
||||||
|
//
|
||||||
|
debug: {
|
||||||
|
// Enables extra debugging output provided by irc-framework.
|
||||||
//
|
//
|
||||||
// @type boolean
|
// @type boolean
|
||||||
// @default false
|
// @default false
|
||||||
//
|
//
|
||||||
debug: false,
|
ircFramework: false,
|
||||||
|
|
||||||
|
// Enables logging raw IRC messages into each server window.
|
||||||
|
//
|
||||||
|
// @type boolean
|
||||||
|
// @default false
|
||||||
|
//
|
||||||
|
raw: false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
@ -67,6 +67,12 @@ function setHome(homePath) {
|
|||||||
var userConfig = require(this.CONFIG_PATH);
|
var userConfig = require(this.CONFIG_PATH);
|
||||||
this.config = _.extend(this.config, userConfig);
|
this.config = _.extend(this.config, userConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Remove in future release
|
||||||
|
if (this.config.debug === true) {
|
||||||
|
log.warn("debug option is now an object, see defaults file for more information.");
|
||||||
|
this.config.debug = {ircFramework: true};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserConfigPath(name) {
|
function getUserConfigPath(name) {
|
||||||
|
@ -81,12 +81,23 @@ module.exports = function(irc, network) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Helper.config.debug) {
|
if (Helper.config.debug.ircFramework) {
|
||||||
irc.on("debug", function(message) {
|
irc.on("debug", function(message) {
|
||||||
log.debug("[" + client.name + " (#" + client.id + ") on " + network.name + " (#" + network.id + ")]", message);
|
log.debug("[" + client.name + " (#" + client.id + ") on " + network.name + " (#" + network.id + ")]", message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Helper.config.debug.raw) {
|
||||||
|
irc.on("raw", function(message) {
|
||||||
|
network.channels[0].pushMessage(client, new Msg({
|
||||||
|
from: message.from_server ? "«" : "»",
|
||||||
|
self: !message.from_server,
|
||||||
|
type: "raw",
|
||||||
|
text: message.line
|
||||||
|
}), true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
irc.on("socket error", function(err) {
|
irc.on("socket error", function(err) {
|
||||||
network.channels[0].pushMessage(client, new Msg({
|
network.channels[0].pushMessage(client, new Msg({
|
||||||
type: Msg.Type.ERROR,
|
type: Msg.Type.ERROR,
|
||||||
|
Loading…
Reference in New Issue
Block a user