本文整理汇总了Python中log.loggersetup.LoggerSetup.add_handler方法的典型用法代码示例。如果您正苦于以下问题:Python LoggerSetup.add_handler方法的具体用法?Python LoggerSetup.add_handler怎么用?Python LoggerSetup.add_handler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log.loggersetup.LoggerSetup
的用法示例。
在下文中一共展示了LoggerSetup.add_handler方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_handler
# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import add_handler [as 别名]
def test_add_handler(self):
LoggerSetup.setup()
name = subprocess.getoutput('tty')
result = LoggerSetup.add_handler(name)
self.assertEqual(True, result)
logging.info('Info on all cli')
result = LoggerSetup.add_handler(name)
self.assertEqual(False, result)
LoggerSetup.shutdown()
示例2: register_tty
# 需要导入模块: from log.loggersetup import LoggerSetup [as 别名]
# 或者: from log.loggersetup.LoggerSetup import add_handler [as 别名]
def register_tty(self, tty_name: str = '') -> bool:
"""
Register tty from cli in logging.
:param tty_name: Name of the console
:return bool: Success of the register
"""
# register console from cli in the current process and logging instance
return LoggerSetup.add_handler(tty_name)