Add a logger to module context on init
This commit is contained in:
parent
48ebc1b1f5
commit
8bcceb641f
@ -369,6 +369,9 @@ class Bot(threading.Thread):
|
|||||||
# Create module context
|
# Create module context
|
||||||
module.__nemubot_context__ = ModuleContext(self, module)
|
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
|
# Replace imported context by real one
|
||||||
for attr in module.__dict__:
|
for attr in module.__dict__:
|
||||||
if attr != "__nemubot_context__" and type(module.__dict__[attr]) == ModuleContext:
|
if attr != "__nemubot_context__" and type(module.__dict__[attr]) == ModuleContext:
|
||||||
|
Loading…
Reference in New Issue
Block a user