You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using make_filtering_bound_logger, one of the pre-created BoundLoggerFilteringAt<level> instances is used. These instances have the fatal & afatal aliases mapped1 to error & aerror respectively, even though the Python fatal alias is mapped to critical in other loggers (including the Python standard library).
(Side note: After diving into structlog internals to figure out why my fatal logs were not going through the processor chain, I figured out that use of the fatal method is discouraged2)
import structlog, logging
print(structlog.__version__) # 24.4.0
structlog.configure(wrapper_class=structlog.make_filtering_bound_logger(logging.CRITICAL))
structlog.get_logger().critical("something went critically wrong") # [critical ] something went critically wrong
structlog.get_logger().fatal("something went fatally wrong") # Log filtered
When using
make_filtering_bound_logger
, one of the pre-createdBoundLoggerFilteringAt<level>
instances is used. These instances have thefatal
&afatal
aliases mapped1 toerror
&aerror
respectively, even though the Pythonfatal
alias is mapped tocritical
in other loggers (including the Python standard library).(Side note: After diving into structlog internals to figure out why my fatal logs were not going through the processor chain, I figured out that use of the
fatal
method is discouraged2)Footnotes
https://github.com/hynek/structlog/blob/87ac2babbd193b3836c5d32c9fa81510c28b82e0/src/structlog/_native.py#L205 ↩
https://github.com/python/cpython/blob/a8be8fc6c4682089be45a87bd5ee1f686040116c/Lib/logging/__init__.py#L1565 ↩
The text was updated successfully, but these errors were encountered: