diff options
| author | Scott <[email protected]> | 2022-01-11 13:33:24 -0800 |
|---|---|---|
| committer | Scott <[email protected]> | 2022-01-11 13:33:24 -0800 |
| commit | b454ad295eb3024a238d32bf2aef1ebc3c496b44 (patch) | |
| tree | 89368a7cdad571da9e2c7297190fdce48eb3feb9 /decorator_utils.py | |
| parent | d2478310649d51e14f8ece57651ca9d925d98793 (diff) | |
Start using warnings from stdlib.
Diffstat (limited to 'decorator_utils.py')
| -rw-r--r-- | decorator_utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/decorator_utils.py b/decorator_utils.py index d5349cc..07ad881 100644 --- a/decorator_utils.py +++ b/decorator_utils.py @@ -479,7 +479,7 @@ def deprecated(func): def wrapper_deprecated(*args, **kwargs): msg = f"Call to deprecated function {func.__qualname__}" logger.warning(msg) - warnings.warn(msg, category=DeprecationWarning) + warnings.warn(msg, category=DeprecationWarning, stacklevel=2) print(msg, file=sys.stderr) return func(*args, **kwargs) return wrapper_deprecated @@ -507,8 +507,8 @@ def thunkify(func): exc[0] = True exc[1] = sys.exc_info() # (type, value, traceback) msg = f"Thunkify has thrown an exception (will be raised on thunk()):\n{traceback.format_exc()}" - print(msg) logger.warning(msg) + warnings.warn(msg) finally: wait_event.set() |
