Python syslog 模块,LOG_WARNING 实例源码

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

项目:anytools    作者:ucookie    | 项目源码 | 文件源码
def confirm_leave(self, owner, level):
        """
        ??????owner,level???????facility,severity
        """
        # ?????
        facility = syslog.LOG_USER
        severity = syslog.LOG_INFO
        # as??????syslog????
        level_info = dict(INFO=syslog.LOG_INFO, WARN=syslog.LOG_WARNING,
                          ERROR=syslog.LOG_ERR, DEBUG=syslog.LOG_DEBUG)

        if level in level_info.keys():
            severity = level_info[level]

        # ????
        if owner in ['ecms_troubleshoot']:
            severity = syslog.syslog.LOG_EMERG

        return facility, severity
项目:glog-cli    作者:globocom    | 项目源码 | 文件源码
def test_format_colored_with_level_warning(self):
        self.message.level = syslog.LOG_WARNING
        log = TailFormatter('({source}) - {message}', color=True).format(self.message)
        self.assertEquals(colored('(dummy.source) - dummy message', 'yellow'), 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'))
项目:logging2    作者:vforgione    | 项目源码 | 文件源码
def as_syslog(self) -> int:
        """Translates the internal library value to its corresponding Syslog value.

        :returns: the corresponding Syslog value
        """
        if self == LogLevel.debug:
            return syslog.LOG_DEBUG
        elif self == LogLevel.info:
            return syslog.LOG_INFO
        elif self == LogLevel.warning:
            return syslog.LOG_WARNING
        else:
            return syslog.LOG_ERR
项目:logging2    作者:vforgione    | 项目源码 | 文件源码
def test_syslog_eq():
    assert LogLevel.debug.as_syslog == syslog.LOG_DEBUG
    assert LogLevel.info.as_syslog == syslog.LOG_INFO
    assert LogLevel.warning.as_syslog == syslog.LOG_WARNING
    assert LogLevel.error.as_syslog == syslog.LOG_ERR
项目:logdevourer    作者:Korbank    | 项目源码 | 文件源码
def _priority(self, levelname):
        return self._PRIORITIES.get(levelname, syslog.LOG_WARNING)
项目: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)