本文整理汇总了Python中logbook.TimedRotatingFileHandler方法的典型用法代码示例。如果您正苦于以下问题:Python logbook.TimedRotatingFileHandler方法的具体用法?Python logbook.TimedRotatingFileHandler怎么用?Python logbook.TimedRotatingFileHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logbook
的用法示例。
在下文中一共展示了logbook.TimedRotatingFileHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: global_init
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import TimedRotatingFileHandler [as 别名]
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)
示例2: add_filebased_log
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import TimedRotatingFileHandler [as 别名]
def add_filebased_log(self, filename):
time_rotating_handler = logbook.TimedRotatingFileHandler(filename,
date_format='%Y-%m-%d',
format_string=self.format_string)
self.add_handler(time_rotating_handler)
示例3: global_init
# 需要导入模块: import logbook [as 别名]
# 或者: from logbook import TimedRotatingFileHandler [as 别名]
def global_init(logfile):
if logfile:
logbook.TimedRotatingFileHandler(
logfile, level=logbook.INFO, date_format='%Y-%m-%d').push_application()
else:
logbook.StreamHandler(sys.stdout, level=logbook.TRACE).push_application()