I want to prefix all the log entries inside one class by self.instance_desc. Like this:
logging.info(f"({self.instance_desc}) {message}")
But I don't want to write the prefix in each message.
How can I make it so it's automatic?
Already done:
I've added a new method to the class:
def log(message):
logging.info(f"({self.instance_desc}) Message")
The problem is that %(filename)s:%(lineno)d is (obviously) pointing to the log method.
Is it possible to do this while %(filename)s:%(lineno)d pointing to the place where the self.log has been called?