To quote @radiophysicist
the problem is that logging doesn't prohibit to register custom log-level with name LeVeL and you try to look it for as LEVEL instead
i.e. we probably need update the method _get_level_value to account for custom log-levels with weird casings:
|
def _get_level_value(level_name: str) -> int: |
|
"""Get numeric value for the log level name given.""" |
|
try: |
|
# Try to get one of predefined log levels |
|
return getattr(logging, level_name) |
|
except AttributeError as e: |
|
# May be it is a custom log level? |
|
level = logging.getLevelName(level_name) |
|
if isinstance(level, int): |
|
return level |
|
|
|
# Re-raise original error |
|
raise ValueError(f"{level_name} is not a valid log level") from e |
To quote @radiophysicist
i.e. we probably need update the method
_get_level_valueto account for custom log-levels with weird casings:structlog-sentry/structlog_sentry/__init__.py
Lines 181 to 193 in db2b9bb