Commit 7a2e4876 authored by Hilal Ozdemir's avatar Hilal Ozdemir

specify plugin name when initializing the logger for plugin

parent 6029c8bc
......@@ -157,7 +157,7 @@ class BeiranDaemon(EventEmitter):
plugin_name = plugin['name']
plugin_package = plugin['package']
try:
config['logger'] = build_logger()
config['logger'] = build_logger('beiran.plugin.' + plugin_name)
config['node'] = self.nodes.local_node
config['daemon'] = self
config['events'] = EVENTS
......@@ -285,7 +285,6 @@ class BeiranDaemon(EventEmitter):
**type_specific_config,
**config.get_plugin_config(plugin['type'], plugin['name'])
})
# Only one discovery plugin at a time is supported (for now)
if plugin['type'] == 'discovery' and plugin['name'] == config.discovery_method:
Services.plugins['discovery'] = _plugin_obj
......
......@@ -27,7 +27,8 @@ from typing import List, Union # pylint: disable=unused-import
from beiran.config import config
def build_logger(filename: str = config.log_file,
def build_logger(name: str = __package__,
filename: str = config.log_file,
log_level: str = logging.getLevelName(config.log_level)) -> logging.Logger:
""" Build logger class for module """
stdout_handler = logging.StreamHandler(sys.stdout)
......@@ -41,4 +42,4 @@ def build_logger(filename: str = config.log_file,
format='[%(asctime)s] [%(name)s] %(levelname)s - %(message)s',
handlers=handlers
)
return logging.getLogger(__package__)
return logging.getLogger(name)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment