Python logbook 模块,TimedRotatingFileHandler() 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用logbook.TimedRotatingFileHandler()

项目:nflpool    作者:prcutler    | 项目源码 | 文件源码
def global_init(log_level_text, filename):
        level = LogService.__get_logbook_logging_level(log_level_text)

        if not filename:
            logbook.StreamHandler(sys.stdout, level=level).push_application()
        else:
            logbook.TimedRotatingFileHandler(
                filename, level=level,
                date_format="%Y-%m-%d").push_application()

        msg = 'Logging initialized, level: {}, mode: {}'.format(
            log_level_text,
            "stdout mode" if not filename else 'file mode: ' + filename
        )

        LogService.get_startup_log().notice(msg)
项目:cookiecutter-pyramid-talk-python-starter    作者:mikeckennedy    | 项目源码 | 文件源码
def global_init(log_level_text, filename):
        level = LogService.__get_logbook_logging_level(log_level_text)

        if not filename:
            logbook.StreamHandler(sys.stdout, level=level).push_application()
        else:
            logbook.TimedRotatingFileHandler(
                filename, level=level,
                date_format="%Y-%m-%d").push_application()

        msg = 'Logging initialized, level: {}, mode: {}'.format(
            log_level_text,
            "stdout mode" if not filename else 'file mode: ' + filename
        )

        LogService.get_startup_log().notice(msg)
项目:cookiecutter-course    作者:mikeckennedy    | 项目源码 | 文件源码
def global_init(log_level_text, filename):
        level = LogService.__get_logbook_logging_level(log_level_text)

        if not filename:
            logbook.StreamHandler(sys.stdout, level=level).push_application()
        else:
            logbook.TimedRotatingFileHandler(
                filename, level=level,
                date_format="%Y-%m-%d").push_application()

        msg = 'Logging initialized, level: {}, mode: {}'.format(
            log_level_text,
            "stdout mode" if not filename else 'file mode: ' + filename
        )

        LogService.get_startup_log().notice(msg)
项目:python_tk_adb    作者:liwanlei    | 项目源码 | 文件源码
def get_logger(name='monkey??????????', file_log=file_stream, level=''):
    """ get logger Factory function """
    logbook.set_datetime_format('local')

    ColorizedStderrHandler(bubble=False, level=level).push_thread()
    logbook.TimedRotatingFileHandler(
            os.path.join(LOG_DIR, '%s.log' % name),
            date_format='%Y-%m-%d-%H', bubble=True, encoding='utf-8').push_thread()
    return logbook.Logger(name)
项目:jiekou-python3    作者:liwanlei    | 项目源码 | 文件源码
def get_logger(name='jiekou', file_log=file_stream, level=''):
    """ get logger Factory function """
    logbook.set_datetime_format('local')

    ColorizedStderrHandler(bubble=False, level=level).push_thread()
    logbook.TimedRotatingFileHandler(
            os.path.join(LOG_DIR, '%s.log' % name),
            date_format='%Y-%m-%d-%H', bubble=True, encoding='utf-8').push_thread()
    return logbook.Logger(name)
项目:FXTest    作者:liwanlei    | 项目源码 | 文件源码
def get_logger(name='jiekou', file_log=file_stream, level=''):
    """ get logger Factory function """
    logbook.set_datetime_format('local')

    ColorizedStderrHandler(bubble=False, level=level).push_thread()
    logbook.TimedRotatingFileHandler(
            os.path.join(LOG_DIR, '%s.log' % name),
            date_format='%Y-%m-%d-%H', bubble=True, encoding='utf-8').push_thread()
    return logbook.Logger(name)