From 070090ffc5feb8e07dc9888a298d9fc2f64d064c Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 13 Sep 2021 19:01:46 +0200 Subject: [PATCH] LogToIrc: Honor the configured log level --- plugins/LogToIrc/__init__.py | 2 ++ plugins/LogToIrc/handler.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/plugins/LogToIrc/__init__.py b/plugins/LogToIrc/__init__.py index 76db31e3e..4de5cd782 100644 --- a/plugins/LogToIrc/__init__.py +++ b/plugins/LogToIrc/__init__.py @@ -51,7 +51,9 @@ __contributors__ = {} from . import config from . import plugin +from . import handler from importlib import reload +importlib.reload(handler) # In case we're being reloaded. importlib.reload(plugin) # In case we're being reloaded. if world.testing: diff --git a/plugins/LogToIrc/handler.py b/plugins/LogToIrc/handler.py index e889056af..d4edb644f 100644 --- a/plugins/LogToIrc/handler.py +++ b/plugins/LogToIrc/handler.py @@ -73,6 +73,12 @@ class IrcHandler(logging.Handler): if networks and irc.network not in networks: continue msgOk = True + + level = config.level.getSpecific( + network=network, channel=target)() + if level > record.levelno: + msgOk = False + if target in irc.state.channels: channel = irc.state.channels[target] modes = config.channelModesRequired.getSpecific(