MCPcopy Create free account
hub / github.com/dabeaz/python-cookbook / logged

Function logged

src/10/monkeypatching_modules_on_import/example2.py:5–10  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

3
4
5def logged(func):
6 @wraps(func)
7 def wrapper(*args, **kwargs):
8 print('Calling', func.__name__, args, kwargs)
9 return func(*args, **kwargs)
10 return wrapper
11
12# Example
13@when_imported('math')

Callers 1

add_loggingFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected