maybe another case of “too blind to search” or “this guy is starting to learn python”
How would I get the function name in the logs without hardcoding it? self.rule_name I already know, but could not find something similar for the function name.
Extenting the logging configuration with %(funcname) does not work either, I get the following:
File "/usr/local/lib/python3.11/logging/__init__.py", line 659, in formatMessage
return self._style.format(record)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/logging/__init__.py", line 451, in format
raise ValueError('Formatting field not found in record: %s' % e)
ValueError: Formatting field not found in record: 'funcname'
Just out of curiosity:
Over the short traceback there should be an extended traceback where you see both the file, line nr and function calls. Is it not there for you?
I believe you are speaking of the full stacktrace in HABApp.log in case of errors, right? If so, yes, this is an important source of information.
What I was trying to do yesterday is to have a lok of the values over time of a few items which are controlled by the Tesla binding. I wanted to see a log of the behaviour over time during a drive, just to exclude that I am having wrong assumptions. And, instead of hardcoding every listener method name in the “Here I am, doing this with that” kind of logging, leaving all of that to the logging framework feels much easier.