deepaugment/lib/decorators.py
def logger(func, logfile_dir=None):
        """Decorator logs the arguments and kwargs of the function it decorates.

        It logs to the file whose path is given by `logfile_dir` argument. If it is not given,
        it creates a new file named `<function-name>.log` in the working directory.
        """
        import logging

        reload(logging)  # ensures it works with Jupyter IPython
        # see https://stackoverflow.com/questions/18786912/

        if logfile_dir is not None:
            import os

            logging.basicConfig(
                filename=os.path.join(logfile_dir, "{}.log".format(func.__name__)),
                level=logging.INFO,
            )
        else:
            logging.basicConfig(
                filename="{}.log".format(func.__name__), level=logging.INFO
            )

        @wraps(func)
        def wrapper(*args, **kwargs):
            logging.info(
                "{} ran with args: {}, and kwargs: {}".format(
                    func.__name__, args, kwargs
                )
            )
            return func(*args, **kwargs)

        return wrapper
Decorator logs the arguments and kwargs of the function it decorates.

        It logs to the file whose path is given by `logfile_dir` argument. If it is not given,
        it creates a new file named `<function-name>.log` in the working directory.
        
Decorator logs the arguments and kwargs of the function it decorates.
It logs to the file whose path is given by `logfile_dir` argument. If it is not given,
it creates a new file named `.log` in the working directory.
Decorator logs the arguments and kwargs of the function it decorates . It logs to the file whose path is given by ` logfile_dir ` argument . If it is not given it creates a new file named ` . log ` in the working directory .
def logger(func, logfile_dir=None):
        import logging
        reload(logging)  
        if logfile_dir is not None:
            import os
            logging.basicConfig(
                filename=os.path.join(logfile_dir, "{}.log".format(func.__name__)),
                level=logging.INFO,
            )
        else:
            logging.basicConfig(
                filename="{}.log".format(func.__name__), level=logging.INFO
            )
        @wraps(func)
        def wrapper(*args, **kwargs):
            logging.info(
                "{} ran with args: {}, and kwargs: {}".format(
                    func.__name__, args, kwargs
                )
            )
            return func(*args, **kwargs)
        return wrapper
def logger ( func , logfile_dir = None ) : import logging reload ( logging ) if logfile_dir is not None : import os logging . basicConfig ( filename = os . path . join ( logfile_dir , "{}.log" . format ( func . __name__ ) ) , level = logging . INFO , ) else : logging . basicConfig ( filename = "{}.log" . format ( func . __name__ ) , level = logging . INFO ) @ wraps ( func ) def wrapper ( * args , ** kwargs ) : logging . info ( "{} ran with args: {}, and kwargs: {}" . format ( func . __name__ , args , kwargs ) ) return func ( * args , ** kwargs ) return wrapper
Decorator logs the arguments and kwargs of the function it decorates.
Decorator logs the arguments and kwargs of the function it decorates .
"""Decorator logs the arguments and kwargs of the function it decorates.

        It logs to the file whose path is given by `logfile_dir` argument. If it is not given,
        it creates a new file named `<function-name>.log` in the working directory.
        """ # ensures it works with Jupyter IPython # see https://stackoverflow.com/questions/18786912/
func
logfile_dir