Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
v1.1.0
- Allow users to set their own stacklevel
v1.0.12
- Properly decode argument to number or string
- Make default level from CLI = None
Expand Down
6 changes: 4 additions & 2 deletions logistro/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ def format(self, record: logging.LogRecord) -> str:
# https://github.com/python/mypy/wiki/Unsupported-Python-Features
class _LogistroLogger(logging.getLoggerClass()): # type: ignore[misc]
def debug1(self, msg: str, *args: Any, **kwargs: Any) -> None:
super().log(logging.DEBUG, msg, *args, stacklevel=2, **kwargs)
stacklevel = kwargs.pop("stacklevel", 0) + 2
super().log(logging.DEBUG, msg, *args, stacklevel=stacklevel, **kwargs)

def debug2(self, msg: str, *args: Any, **kwargs: Any) -> None:
super().log(DEBUG2, msg, *args, stacklevel=2, **kwargs)
stacklevel = kwargs.pop("stacklevel", 0) + 2
super().log(DEBUG2, msg, *args, stacklevel=stacklevel, **kwargs)


logging.setLoggerClass(_LogistroLogger)
Expand Down