Skip to content

Commit 74d0fb1

Browse files
fix: Added logging.LoggerAdapter to _MaybeLogger union (#34)
The docs say about `logging.LoggerAdapter`: <blockquote> An easy way in which you can pass contextual information to be output along with logging event information is to use the [`LoggerAdapter`](https://docs.python.org/3/library/logging.html#logging.LoggerAdapter) class. This class is designed to look like a [`Logger`](https://docs.python.org/3/library/logging.html#logging.Logger), so that you can call [`debug()`](https://docs.python.org/3/library/logging.html#logging.debug), [`info()`](https://docs.python.org/3/library/logging.html#logging.info), [`warning()`](https://docs.python.org/3/library/logging.html#logging.warning), [`error()`](https://docs.python.org/3/library/logging.html#logging.error), [`exception()`](https://docs.python.org/3/library/logging.html#logging.exception), [`critical()`](https://docs.python.org/3/library/logging.html#logging.critical) and [`log()`](https://docs.python.org/3/library/logging.html#logging.log). These methods have the same signatures as their counterparts in [`Logger`](https://docs.python.org/3/library/logging.html#logging.Logger), so you can use the two types of instances interchangeably. </blockquote> Co-authored-by: Jean-Charles BERTIN <[email protected]>
1 parent a0dc886 commit 74d0fb1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@
22

33
## Unreleased
44

5-
- Adapt test cases to pytest-asyncio 1.0 compatibility https://github.com/python-backoff/backoff/pull/1
5+
### Fixed
6+
67
- Use `inspect.iscoroutinefunction` instead of `asyncio.iscoroutinefunction` to avoid Python 3.14 deprecation warning https://github.com/python-backoff/backoff/pull/3
7-
- Use uv for dependencies and packaging https://github.com/python-backoff/backoff/pull/7
8+
- Adapt test cases to pytest-asyncio 1.0 compatibility https://github.com/python-backoff/backoff/pull/1 from @pastalian
89
- Include tests in source distribution https://github.com/python-backoff/backoff/pull/13
10+
- Added `logging.LoggerAdapter` to `_MaybeLogger` union https://github.com/python-backoff/backoff/pull/34 from @jcbertin
11+
12+
### Packaging
13+
14+
- Use uv for dependencies and packaging https://github.com/python-backoff/backoff/pull/7
915

1016
## [v2.2.1] - 2022-10-05
1117

backoff/_typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class Details(_Details, total=False):
3838
]
3939
_Jitterer = Callable[[float], float]
4040
_MaybeCallable = Union[T, Callable[[], T]]
41-
_MaybeLogger = Union[str, logging.Logger, None]
41+
_MaybeLogger = Union[str, logging.Logger, logging.LoggerAdapter, None]
4242
_MaybeSequence = Union[T, Sequence[T]]
4343
_Predicate = Callable[[T], bool]
4444
_WaitGenerator = Callable[..., Generator[float, None, None]]

0 commit comments

Comments
 (0)