当前位置: 首页>>代码示例>>Python>>正文


Python Logging.get_logger方法代码示例

本文整理汇总了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)
开发者ID:ksripathi,项目名称:ovpl,代码行数:13,代码来源:test.py

示例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)
开发者ID:ksripathi,项目名称:ovpl,代码行数:17,代码来源:test.py

示例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)
开发者ID:ksripathi,项目名称:ovpl,代码行数:9,代码来源:test.py

示例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')
开发者ID:ksripathi,项目名称:ovpl,代码行数:6,代码来源:test.py


注:本文中的Logging.get_logger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。