mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Added 'actor' among the fields of the structured log messages; minor other fixes
This commit is contained in:
@@ -26,14 +26,14 @@ class Logger(object):
|
||||
def _add_prefix(self, msg):
|
||||
return msg if self.actor is None else "[{}] {}".format(self.actor, msg)
|
||||
|
||||
def info(msg, **kwargs):
|
||||
logging.info(StructuredMessage(self._add_prefix(msg), **kwargs))
|
||||
def info(self, msg, **kwargs):
|
||||
logging.info(StructuredMessage(self._add_prefix(msg), actor=self.actor, **kwargs))
|
||||
|
||||
def debug(msg, **kwargs):
|
||||
logging.debug(StructuredMessage(self._add_prefix(msg), **kwargs))
|
||||
def debug(self, msg, **kwargs):
|
||||
logging.debug(StructuredMessage(self._add_prefix(msg), actor=self.actor, **kwargs))
|
||||
|
||||
def error(msg, **kwargs):
|
||||
logging.error(StructuredMessage(self._add_prefix(msg), **kwargs))
|
||||
def error(self, msg, **kwargs):
|
||||
logging.error(StructuredMessage(self._add_prefix(msg), actor=self.actor, **kwargs))
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(format='%(message)s', level=logging.INFO, handlers=[
|
||||
|
||||
Reference in New Issue
Block a user