Skip to content

Instantly share code, notes, and snippets.

@r3dm1ke
Last active October 30, 2020 01:17
Show Gist options
  • Save r3dm1ke/d2325c3f9ef5fae3f96ffa05fc1e6f90 to your computer and use it in GitHub Desktop.
Save r3dm1ke/d2325c3f9ef5fae3f96ffa05fc1e6f90 to your computer and use it in GitHub Desktop.
def logging_decorator(func):
def logging_wrapper(*args, **kwargs):
print(f'Before {func.__name__}')
func(*args, **kwargs)
print(f'After {func.__name__}')
return logging_wrapper
@logging_decorator
def sum(x, y):
print(x + y)
sum(2, 5)
> Before sum
> 7
> After sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment