本文整理匯總了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()