Replaced ambiguous logger variable name

This commit is contained in:
Fabio Manganiello 2022-11-11 20:37:39 +01:00
parent 00a43dd1f8
commit 84bb77bd5b
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -27,7 +27,7 @@ from .utils import set_thread_name, get_enabled_plugins
__author__ = 'Fabio Manganiello <info@fabiomanganiello.com>' __author__ = 'Fabio Manganiello <info@fabiomanganiello.com>'
__version__ = '0.23.6' __version__ = '0.23.6'
logger = logging.getLogger('platypush') log = logging.getLogger('platypush')
class Daemon: class Daemon:
@ -181,7 +181,7 @@ class Daemon:
try: try:
msg.execute(n_tries=self.n_tries) msg.execute(n_tries=self.n_tries)
except PermissionError: except PermissionError:
logger.info('Dropped unauthorized request: {}'.format(msg)) log.info('Dropped unauthorized request: {}'.format(msg))
self.processed_requests += 1 self.processed_requests += 1
if ( if (
@ -190,10 +190,10 @@ class Daemon:
): ):
self.stop_app() self.stop_app()
elif isinstance(msg, Response): elif isinstance(msg, Response):
logger.info('Received response: {}'.format(msg)) log.info('Received response: {}'.format(msg))
elif isinstance(msg, Event): elif isinstance(msg, Event):
if not msg.disable_logging: if not msg.disable_logging:
logger.info('Received event: {}'.format(msg)) log.info('Received event: {}'.format(msg))
self.event_processor.process_event(msg) self.event_processor.process_event(msg)
return _f return _f
@ -225,12 +225,12 @@ class Daemon:
def run(self): def run(self):
"""Start the daemon""" """Start the daemon"""
if not self.no_capture_stdout: if not self.no_capture_stdout:
sys.stdout = Logger(logger.info) sys.stdout = Logger(log.info)
if not self.no_capture_stderr: if not self.no_capture_stderr:
sys.stderr = Logger(logger.warning) sys.stderr = Logger(log.warning)
set_thread_name('platypush') set_thread_name('platypush')
logger.info('---- Starting platypush v.{}'.format(__version__)) log.info('---- Starting platypush v.{}'.format(__version__))
# Initialize the backends and link them to the bus # Initialize the backends and link them to the bus
self.backends = register_backends(bus=self.bus, global_scope=True) self.backends = register_backends(bus=self.bus, global_scope=True)
@ -256,7 +256,7 @@ class Daemon:
try: try:
self.bus.poll() self.bus.poll()
except KeyboardInterrupt: except KeyboardInterrupt:
logger.info('SIGINT received, terminating application') log.info('SIGINT received, terminating application')
finally: finally:
self.stop_app() self.stop_app()