From 0c3dc31e31fa85efcfc445b8a65bfd8817a040b6 Mon Sep 17 00:00:00 2001 From: Maxime Poulin Date: Sat, 6 Aug 2016 14:39:39 -0400 Subject: [PATCH] Add debug config option for irc-fw debug log --- defaults/config.js | 9 ++++++++- src/plugins/irc-events/connection.js | 10 ++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/defaults/config.js b/defaults/config.js index 254d2a4a..09cd40b6 100644 --- a/defaults/config.js +++ b/defaults/config.js @@ -357,6 +357,13 @@ module.exports = { // @default "uid" // primaryKey: "uid" - } + }, + // Enables extra debugging output. Turn this on if you experience + // IRC connection issues and want to file a bug report. + // + // @type boolean + // @default false + // + debug: false, }; diff --git a/src/plugins/irc-events/connection.js b/src/plugins/irc-events/connection.js index 72b4b7cd..fe356102 100644 --- a/src/plugins/irc-events/connection.js +++ b/src/plugins/irc-events/connection.js @@ -2,6 +2,7 @@ var _ = require("lodash"); var identd = require("../../identd"); var Msg = require("../../models/msg"); var Chan = require("../../models/chan"); +var Helper = require("../../helper"); module.exports = function(irc, network) { var client = this; @@ -74,10 +75,11 @@ module.exports = function(irc, network) { }); } - // TODO Add a debug mode. See https://github.com/thelounge/lounge/issues/459 - // irc.on("debug", function(message) { - // log.debug("[" + client.name + " (#" + client.id + ") on " + network.name + " (#" + network.id + ")]", message); - // }); + if (Helper.config.debug) { + irc.on("debug", function(message) { + log.debug("[" + client.name + " (#" + client.id + ") on " + network.name + " (#" + network.id + ")]", message); + }); + } irc.on("socket error", function(err) { network.channels[0].pushMessage(client, new Msg({