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


Python logger.set_level函数代码示例

本文整理汇总了Python中shinken.log.logger.set_level函数的典型用法代码示例。如果您正苦于以下问题:Python set_level函数的具体用法?Python set_level怎么用?Python set_level使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_level函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_basic_logging_error

 def test_basic_logging_error(self):
     logger.set_level(logger.ERROR)
     msgs, lines = self._put_log(logger.error, 'Some log-message')
     self.assertEqual(len(msgs), 1)
     self.assertEqual(len(lines), 1)
     self.assertRegexpMatches(msgs[0], r'^\[\d+\] Error :\s+Some log-message\n$')
     self.assertRegexpMatches(lines[0], r'^\[\d+\] Error :\s+Some log-message$')
开发者ID:adenir2202,项目名称:shinken,代码行数:7,代码来源:test_logging.py

示例2: test_basic_logging_warning

 def test_basic_logging_warning(self):
     logger.set_level(logger.WARNING)
     msgs, lines = self._put_log(logger.warning, 'Some log-message')
     self.assertEqual(len(msgs), 1)
     self.assertEqual(len(lines), 1)
     self.assertRegexpMatches(msgs[0], r'^\[\d+\] Warning :\s+Some log-message\n$')
     self.assertRegexpMatches(lines[0], r'^\[\d+\] Warning :\s+Some log-message$')
开发者ID:adenir2202,项目名称:shinken,代码行数:7,代码来源:test_logging.py

示例3: test_basic_logging_info

 def test_basic_logging_info(self):
     logger.set_level(logger.INFO)
     msgs, lines = self._put_log(logger.info, 'Some log-message')
     self.assertEqual(len(msgs), 1)
     self.assertEqual(len(lines), 1)
     self.assertRegexpMatches(msgs[0], r'^\[\d+\] Info :\s+Some log-message\n$')
     self.assertRegexpMatches(lines[0], r'^\[\d+\] Info :\s+Some log-message$')
开发者ID:adenir2202,项目名称:shinken,代码行数:7,代码来源:test_logging.py

示例4: test_basic_logging_critical

 def test_basic_logging_critical(self):
     logger.set_level(logger.CRITICAL)
     msgs, lines, local_log = self._put_log(logger.critical, 'Some log-message')
     self.assertEqual(len(msgs), 1)
     self.assertEqual(len(lines), 1)
     self.assertEqual(len(local_log), 1)
     self.assertRegexpMatches(local_log[0],
         r' \[\d+\] Critical :\s+Some log-message\n$')
开发者ID:adenir2202,项目名称:shinken,代码行数:8,代码来源:test_logging.py

示例5: test_basic_logging_debug_does_not_send_broks

 def test_basic_logging_debug_does_not_send_broks(self):
     logger.set_level(logger.DEBUG)
     msgs, lines, local_log = self._put_log(logger.debug, 'Some log-message')
     self.assertEqual(len(msgs), 0)
     self.assertEqual(len(lines), 1)
     self.assertEqual(len(local_log), 1)
     self.assertRegexpMatches(local_log[0],
         r' \[\d+\] Debug :\s+Some log-message$')
开发者ID:adenir2202,项目名称:shinken,代码行数:8,代码来源:test_logging.py

示例6: test_register_local_log_keeps_level

 def test_register_local_log_keeps_level(self):
     logger.set_level(logger.ERROR)
     self.assertEqual(logger._level, logger.ERROR)
     logfile = NamedTemporaryFile("w")
     logfile.close()
     logfile_name = logfile.name
     logger.register_local_log(logfile_name)
     self.assertEqual(logger._level, logger.ERROR)
开发者ID:adenir2202,项目名称:shinken,代码行数:8,代码来源:test_logging.py

示例7: test_human_timestamp_format

 def test_human_timestamp_format(self):
     logger.set_level(logger.INFO)
     logger.set_human_format(True)
     msgs, lines = self._put_log(logger.info, 'Some ] log-message')
     self.assertRegexpMatches(msgs[0],
         r'^\[[^\]]+] Info :\s+\[Tiroler Schinken\] Some \] log-message\n$')
     time.strptime(msgs[0].split(' Info :    ', 1)[0], '[%a %b %d %H:%M:%S %Y]')
     self.assertRegexpMatches(lines[0],
         r'^\[[^\]]+] Info :\s+\[Tiroler Schinken\] Some \] log-message$')
     time.strptime(msgs[0].split(' Info :    ', 1)[0], '[%a %b %d %H:%M:%S %Y]')
     logger.set_human_format(False)
开发者ID:adenir2202,项目名称:shinken,代码行数:11,代码来源:test_logging.py

示例8: test_level_is_higher_then_the_one_set

    def test_level_is_higher_then_the_one_set(self):
        # just test two samples
        logger.set_level(logger.CRITICAL)
        msgs, lines = self._put_log(logger.error, 'Some log-message')
        self.assertEqual(len(msgs), 0)
        self.assertEqual(len(lines), 0)

        logger.set_level(logger.INFO)
        msgs, lines = self._put_log(logger.debug, 'Some log-message$')
        self.assertEqual(len(msgs), 0)
        self.assertEqual(len(lines), 0)
开发者ID:adenir2202,项目名称:shinken,代码行数:11,代码来源:test_logging.py

示例9: test_load_obj_must_not_change_level

 def test_load_obj_must_not_change_level(self):
     # argl, load_obj() unsets the level! save and restore it
     logger.set_level(logger.CRITICAL)
     logger.load_obj(Dummy())
     self.assertEqual(logger._level, logger.CRITICAL)
开发者ID:adenir2202,项目名称:shinken,代码行数:5,代码来源:test_logging.py

示例10: test_set_level

 def test_set_level(self):
     logger.set_level(logger.WARNING)
     self.assertEqual(logger._level, logger.WARNING)
开发者ID:adenir2202,项目名称:shinken,代码行数:3,代码来源:test_logging.py

示例11: Dummy

    from shinken.bin import VERSION
except ImportError:
    # If importing shinken fails, try to load from current directory
    # or parent directory to support running without installation.
    # Submodules will then be loaded from there, too.
    import imp
    imp.load_module('shinken', *imp.find_module('shinken', [os.path.realpath("."), os.path.realpath(".."), os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "..")]))
    from shinken.bin import VERSION

from shinken.objects.pack import Pack,Packs

from shinken.log import logger
from shinken.objects.config import Config


logger.set_level(10)
class Dummy():
    def __init__(self): pass
    def add(self, obj) : pass
logger.load_obj(Dummy())


from pymongo.connection import Connection

VERSION = '0.1'
TMP_PATH = '/tmp/pack_analysing'
PACKS_HOME= '/opt/packs'

def do_list(table):
    search = table.find()
    for s in search:
开发者ID:Morkxy,项目名称:shinken,代码行数:31,代码来源:hostd_packs.py


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