本文整理汇总了Python中Logging.get_logger方法的典型用法代码示例。如果您正苦于以下问题:Python Logging.get_logger方法的具体用法?Python Logging.get_logger怎么用?Python Logging.get_logger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logging
的用法示例。
在下文中一共展示了Logging.get_logger方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_multiple_loggers_same_name
# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import get_logger [as 别名]
def test_multiple_loggers_same_name(self):
"""Test if multiple loggers with same name work"""
logger1 = Logging.get_logger("controller", level)
logger2 = Logging.get_logger("controller", level)
logger3 = Logging.get_logger("controller", level)
open(controller_path, 'w').close()
for i in range(num_logs):
logger1.debug(message)
logger2.debug(message)
logger3.debug(message)
self.assertEquals(count_num_lines(controller_path), num_logs*3)
示例2: test_multiple_logger_different_names
# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import get_logger [as 别名]
def test_multiple_logger_different_names(self):
"""Test if multiple loggers with different name work"""
logger1 = Logging.get_logger("controller", level)
logger2 = Logging.get_logger("vmmanager", level)
logger3 = Logging.get_logger("adapter", level)
open(controller_path, 'w').close()
open(vmmanager_path, 'w').close()
open(adapter_path, 'w').close()
for i in range(num_logs):
logger1.debug(message)
logger2.debug(message)
logger3.debug(message)
sum = count_num_lines(controller_path)+count_num_lines(vmmanager_path)\
+ count_num_lines(adapter_path)
self.assertEquals(sum, num_logs*3)
示例3: test_log_using_logger
# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import get_logger [as 别名]
def test_log_using_logger(self):
"""Test if the logging calls write messages to the log files"""
logger = Logging.get_logger(logger_name, level)
open(controller_path, 'w').close()
for i in range(num_logs):
logger.debug(message)
self.assertEquals(count_num_lines(controller_path), num_logs)
示例4: test_get_logger_returns_logger
# 需要导入模块: import Logging [as 别名]
# 或者: from Logging import get_logger [as 别名]
def test_get_logger_returns_logger(self):
"""Test if get_logger() returns logger object"""
logger = Logging.get_logger(logger_name, level)
self.assertEquals(logger.__class__.__name__, 'Logger')