Add a logger to module context on init

This commit is contained in:
nemunaire 2015-03-26 07:45:33 +01:00
parent 48ebc1b1f5
commit 8bcceb641f

View File

@ -369,6 +369,9 @@ class Bot(threading.Thread):
# Create module context
module.__nemubot_context__ = ModuleContext(self, module)
if not hasattr(module, "logger"):
module.logger = logging.getLogger("nemubot.module." + module.__name__)
# Replace imported context by real one
for attr in module.__dict__:
if attr != "__nemubot_context__" and type(module.__dict__[attr]) == ModuleContext: