human
I am working on the file "Closure a dekorator.ipynb".
The first task is:
Pouzit to viem napriklad na vytvorenie dekoratora, ktory mi bude logovat volania funkcie a ja si zvolim uroven logovania
Can you write Python program for it?
 ... Can you provide a the Python program you requested?
assistant
#Here is the Python program you requested.

def log(level, message):
    print("{0}: {1}".format(level, message))

def log_decorator(level):
    def decorator(f):
        def wrapper(*args, **kwargs):
            log(level, "Function {} started.".format(f.__name__))
            result = f(*args, **kwargs)
            log(level, "Function {} finished.".format(f.__name__))
            return result
        return wrapper
    return decorator

@log_decorator('debug')
def my_print(*args):
    print(*args)
    
my_print('ide to?')