Created
April 6, 2014 19:33
-
-
Save e-chernigovskii/10010527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'Evgeny Chernigovsky' | |
import logging | |
def logging_decorator(filename): | |
def inner_decorator(func): | |
def wrap(*args, **kwargs): | |
logging.basicConfig(filename=filename, level=logging.INFO) | |
pattern = 'Function {0} was called with args:\n{1}\nand kwargs:\n{2}' | |
logging.info(pattern.format(func.__name__, args, kwargs)) | |
func(*args, **kwargs) | |
return wrap | |
return inner_decorator | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment