

def configure_logger(stdout=True, filepath=None, level=logging.INFO):
    logger = logging.getLogger('ws4py')
    logger.setLevel(level)
    logfmt = logging.Formatter('[%(asctime)s] %(levelname)s %(message)s')
    if filepath:
        h = handlers.RotatingFileHandler(filepath, maxBytes=10485760, backupCount=3)
        h.setLevel(level)
        h.setFormatter(logfmt)
        logger.addHandler(h)
    if stdout:
        import sys
        h = logging.StreamHandler(sys.stdout)
        h.setLevel(level)
        h.setFormatter(logfmt)
        logger.addHandler(h)
    return logger

dataset/ETHPy150Open Lawouach/WebSocket-for-Python/ws4py/__init__.py configure_logger/original