Python syslog 模块,LOG_CRIT 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用syslog.LOG_CRIT

项目:glog-cli    作者:globocom    | 项目源码 | 文件源码
def test_format_colored_with_level_critical(self):
        self.message.level = syslog.LOG_CRIT
        log = TailFormatter('({source}) - {message}', color=True).format(self.message)
        self.assertEquals(colored('(dummy.source) - dummy message', 'white', 'on_red'), log)
项目:glog-cli    作者:globocom    | 项目源码 | 文件源码
def test_get_log_level_from_code(self):
        self.assertEquals('CRITICAL', LogLevel.find_by_syslog_code(syslog.LOG_CRIT)['name'])
        self.assertEquals('WARNING', LogLevel.find_by_syslog_code(syslog.LOG_WARNING)['name'])
        self.assertEquals('DEBUG', LogLevel.find_by_syslog_code(syslog.LOG_DEBUG)['name'])
        self.assertEquals('INFO', LogLevel.find_by_syslog_code(syslog.LOG_INFO)['name'])
        self.assertEquals('ERROR', LogLevel.find_by_syslog_code(syslog.LOG_ERR)['name'])
        self.assertEquals('NOTICE', LogLevel.find_by_syslog_code(syslog.LOG_NOTICE)['name'])
        self.assertEquals('', LogLevel.find_by_syslog_code(9999)['name'])
项目:glog-cli    作者:globocom    | 项目源码 | 文件源码
def test_get_log_level_code(self):
        self.assertEquals(syslog.LOG_CRIT, LogLevel.find_by_level_name('CRITICAL'))
        self.assertEquals(syslog.LOG_WARNING, LogLevel.find_by_level_name('WARNING'))
        self.assertEquals(syslog.LOG_DEBUG, LogLevel.find_by_level_name('DEBUG'))
        self.assertEquals(syslog.LOG_INFO, LogLevel.find_by_level_name('INFO'))
        self.assertEquals(syslog.LOG_ERR, LogLevel.find_by_level_name('ERROR'))
        self.assertEquals(syslog.LOG_NOTICE, LogLevel.find_by_level_name('NOTICE'))
        self.assertIsNone(LogLevel.find_by_level_name('UNKNOWN'))
项目:python-logbook-systemd    作者:vivienm    | 项目源码 | 文件源码
def test_levels(journal, logger):
    """Mapping between log levels and Syslog priorities."""
    with JournalHandler().threadbound():
        logger.critical('Critical message')
        assert journal['PRIORITY'] == str(syslog.LOG_CRIT)
        logger.error('Error message')
        assert journal['PRIORITY'] == str(syslog.LOG_ERR)
        logger.warning('Warning message')
        assert journal['PRIORITY'] == str(syslog.LOG_WARNING)
        logger.notice('Notice message')
        assert journal['PRIORITY'] == str(syslog.LOG_NOTICE)
        logger.info('Info message')
        assert journal['PRIORITY'] == str(syslog.LOG_INFO)
        logger.debug('Debug message')
        assert journal['PRIORITY'] == str(syslog.LOG_DEBUG)