Python syslog 模块,LOG_DEBUG 实例源码

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

项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def _get_logging_level(level):
        """ Map a syslog level to a logging level. The logging module
        levels start from 10 (DEBUG) and increase by 10 for every level of
        of severity (INFO, WARNING, ERROR, CRITICAL). syslog starts at 0
        for the most severe messages (EMERGENCY) and increases by 1 for
        each lower level of messages (ALERT, CRITICAL, etc.). Mapping is
        mostly straightforward. """
        assert level >= 0
        if level >= logging.DEBUG:
            # level is already a logging-compatible value
            return level
        if level > LOG_DEBUG:
            return logging.DEBUG
        return [
            logging.CRITICAL,  # syslog.LOG_EMERG
            logging.CRITICAL,  # syslog.LOG_ALERT,
            logging.CRITICAL,  # syslog.LOG_CRIT,
            logging.ERROR,     # syslog.LOG_ERR,
            logging.WARNING,   # syslog.LOG_WARNING,
            _NOTICE,           # syslog.LOG_NOTICE,
            logging.INFO,      # syslog.LOG_INFO,
            logging.DEBUG,     # syslog.LOG_DEBUG
        ][level]
项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def _get_logging_level(level):
        """ Map a syslog level to a logging level. The logging module
        levels start from 10 (DEBUG) and increase by 10 for every level of
        of severity (INFO, WARNING, ERROR, CRITICAL). syslog starts at 0
        for the most severe messages (EMERGENCY) and increases by 1 for
        each lower level of messages (ALERT, CRITICAL, etc.). Mapping is
        mostly straightforward. """
        assert level >= 0
        if level >= logging.DEBUG:
            # level is already a logging-compatible value
            return level
        if level > LOG_DEBUG:
            return logging.DEBUG
        return [
            logging.CRITICAL,  # syslog.LOG_EMERG
            logging.CRITICAL,  # syslog.LOG_ALERT,
            logging.CRITICAL,  # syslog.LOG_CRIT,
            logging.ERROR,     # syslog.LOG_ERR,
            logging.WARNING,   # syslog.LOG_WARNING,
            _NOTICE,           # syslog.LOG_NOTICE,
            logging.INFO,      # syslog.LOG_INFO,
            logging.DEBUG,     # syslog.LOG_DEBUG
        ][level]
项目:CommunityCellularManager    作者:facebookincubator    | 项目源码 | 文件源码
def _get_logging_level(level):
        """ Map a syslog level to a logging level. The logging module
        levels start from 10 (DEBUG) and increase by 10 for every level of
        of severity (INFO, WARNING, ERROR, CRITICAL). syslog starts at 0
        for the most severe messages (EMERGENCY) and increases by 1 for
        each lower level of messages (ALERT, CRITICAL, etc.). Mapping is
        mostly straightforward. """
        assert level >= 0
        if level >= logging.DEBUG:
            # level is already a logging-compatible value
            return level
        if level > LOG_DEBUG:
            return logging.DEBUG
        return [
            logging.CRITICAL,  # syslog.LOG_EMERG
            logging.CRITICAL,  # syslog.LOG_ALERT,
            logging.CRITICAL,  # syslog.LOG_CRIT,
            logging.ERROR,     # syslog.LOG_ERR,
            logging.WARNING,   # syslog.LOG_WARNING,
            _NOTICE,           # syslog.LOG_NOTICE,
            logging.INFO,      # syslog.LOG_INFO,
            logging.DEBUG,     # syslog.LOG_DEBUG
        ][level]
项目: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
项目:weewx-wh23xx    作者:matthewwall    | 项目源码 | 文件源码
def genLoopPackets(self):
        while True:
            raw = self._get_current()
            logdbg("raw data: %s" % raw)
            if raw:
                try:
                    decoded = WH23xxStation.decode_weather_data(raw)
                    logdbg("decoded data: %s" % decoded)
                    if decoded:
                        packet = self._data_to_packet(decoded)
                        logdbg("packet: %s" % packet)
                        yield packet
                except IndexError, e:
                    logerr("decode failed: %s (%s)" % (e, _fmt(raw)))
                    log_traceback(loglevel=syslog.LOG_DEBUG)
            time.sleep(self._poll_interval)
项目:glog-cli    作者:globocom    | 项目源码 | 文件源码
def test_format_colored_with_level_debug(self):
        self.message.level = syslog.LOG_DEBUG
        log = TailFormatter('({source}) - {message}', color=True).format(self.message)
        self.assertEquals(colored('(dummy.source) - dummy message', 'cyan'), 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'))
项目:weewx-influx    作者:matthewwall    | 项目源码 | 文件源码
def logdbg(msg):
    logmsg(syslog.LOG_DEBUG, msg)
项目:weewx-interceptor    作者:matthewwall    | 项目源码 | 文件源码
def logdbg(msg):
    logmsg(syslog.LOG_DEBUG, msg)
项目: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
项目:weewx-sdr    作者:matthewwall    | 项目源码 | 文件源码
def logdbg(msg):
    logmsg(syslog.LOG_DEBUG, msg)
项目:weewx-highcharts    作者:gjr80    | 项目源码 | 文件源码
def logdbg(msg):
    logmsg(syslog.LOG_DEBUG, msg)
项目:weewx-highcharts    作者:gjr80    | 项目源码 | 文件源码
def logdbg2(msg):
    if weewx.debug >= 2:
        logmsg(syslog.LOG_DEBUG, msg)
项目:weewx-highcharts    作者:gjr80    | 项目源码 | 文件源码
def logdbg(msg):
    logmsg(syslog.LOG_DEBUG, msg)
项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def test_emitCustomPriority(self):
        """
        L{SyslogObserver.emit} uses the value of the C{'syslogPriority'} as the
        syslog priority, if that key is present in the event dictionary.
        """
        self.observer.emit({
                'message': ('hello, world',), 'isError': False, 'system': '-',
                'syslogPriority': stdsyslog.LOG_DEBUG})
        self.assertEqual(
            self.events,
            [(stdsyslog.LOG_DEBUG, '[-] hello, world')])
项目:drac    作者:stackhpc    | 项目源码 | 文件源码
def debug(module, message):
    """Log a debug message.

    :param module: The AnsibleModule instance
    :param message: The message to log
    """
    log_args = {"PRIORITY": syslog.LOG_DEBUG, "MODULE": "drac",
                "CODE_FILE": "drac.py"}
    module.log(message, log_args)
项目:weewx-wh23xx    作者:matthewwall    | 项目源码 | 文件源码
def logdbg(msg):
    logmsg(syslog.LOG_DEBUG, msg)
项目: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)