mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-18 14:44:21 +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):
|
def _add_prefix(self, msg):
|
||||||
return msg if self.actor is None else "[{}] {}".format(self.actor, msg)
|
return msg if self.actor is None else "[{}] {}".format(self.actor, msg)
|
||||||
|
|
||||||
def info(msg, **kwargs):
|
def info(self, msg, **kwargs):
|
||||||
logging.info(StructuredMessage(self._add_prefix(msg), **kwargs))
|
logging.info(StructuredMessage(self._add_prefix(msg), actor=self.actor, **kwargs))
|
||||||
|
|
||||||
def debug(msg, **kwargs):
|
def debug(self, msg, **kwargs):
|
||||||
logging.debug(StructuredMessage(self._add_prefix(msg), **kwargs))
|
logging.debug(StructuredMessage(self._add_prefix(msg), actor=self.actor, **kwargs))
|
||||||
|
|
||||||
def error(msg, **kwargs):
|
def error(self, msg, **kwargs):
|
||||||
logging.error(StructuredMessage(self._add_prefix(msg), **kwargs))
|
logging.error(StructuredMessage(self._add_prefix(msg), actor=self.actor, **kwargs))
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
logging.basicConfig(format='%(message)s', level=logging.INFO, handlers=[
|
logging.basicConfig(format='%(message)s', level=logging.INFO, handlers=[
|
||||||
|
|||||||
Reference in New Issue
Block a user