22from functools import wraps
33from typing import Any , Callable , Literal , Optional , ParamSpec , Tuple , TypeAlias , TypeVar , Union , overload
44
5- LOG_LEVEL : TypeAlias = Literal ['CRITICAL' , 'ERROR' , 'WARNING' , 'INFO' , 'DEBUG' , 'NOTSET' , 'DEFAULT' ]
5+ LOG_LEVEL : TypeAlias = Literal ['CRITICAL' , 'ERROR' , 'WARNING' , 'INFO' , 'DEBUG' , 'NOTSET' ]
66
77P = ParamSpec ("P" )
88R = TypeVar ("R" )
@@ -17,7 +17,7 @@ def logwrap(
1717 A simple dynamic decorator to log function calls using the `logging` module with your current project configurations.
1818 Use the `LOG_LEVEL` literal to specify standard log levels.
1919
20- LOG_LEVEL = ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET', 'DEFAULT' ]
20+ LOG_LEVEL = ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET']
2121
2222 - The messages are formatted dynamically using templating.
2323 - Available variables:
@@ -88,8 +88,8 @@ def normalize(
8888 return option
8989
9090 before = normalize ('DEBUG' , 'Calling {func} - kwargs={kwargs}' , before )
91- after = normalize ('INFO' , 'Function {func} ended. result={result}' , after )
9291 on_exception = normalize ('ERROR' , 'Error in {func}: {e}' , on_exception )
92+ after = normalize ('INFO' , 'Function {func} ended. result={result}' , after )
9393
9494 def decorator (func : Callable [P , R ]) -> Callable [P , R ]:
9595 sig = inspect .signature (func )
0 commit comments