But I also want the exception to be included in the exception log message so I added structlog.processors.format_exc_info but then I get the following exception already on log.info():
Traceback (most recent call last):
File "/home/me/git/repo_name/test_log.py", line 12, in <module>
log.info("Started")
File "/home/me/.cache/pypoetry/virtualenvs/repo_name-vETpVZ8U-py3.12/lib/python3.12/site-packages/structlog/_native.py", line 134, in meth
return self._proxy_to_logger(name, event, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/.cache/pypoetry/virtualenvs/repo_name-vETpVZ8U-py3.12/lib/python3.12/site-packages/structlog/_base.py", line 214, in _proxy_to_logger
args, kw = self._process_event(method_name, event, event_kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/.cache/pypoetry/virtualenvs/repo_name-vETpVZ8U-py3.12/lib/python3.12/site-packages/structlog/_base.py", line 165, in _process_event
event_dict = proc(self._logger, method_name, event_dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/me/.cache/pypoetry/virtualenvs/repo_name-vETpVZ8U-py3.12/lib/python3.12/site-packages/structlog/processors.py", line 410, in __call__
exc_info = event_dict.pop("exc_info", None)
^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'pop'
I'm trying to log thrown exceptions. Using structlog 24.4.0 and Python 3.12.5.
This is what I'm running:
This works and prints
But I also want the exception to be included in the exception log message so I added
structlog.processors.format_exc_info
but then I get the following exception already onlog.info()
:Is this a bug or am I using the library wrong?