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


Python syslog.LOG_ERR属性代码示例

本文整理汇总了Python中syslog.LOG_ERR属性的典型用法代码示例。如果您正苦于以下问题:Python syslog.LOG_ERR属性的具体用法?Python syslog.LOG_ERR怎么用?Python syslog.LOG_ERR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在syslog的用法示例。


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

示例1: error_log

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def error_log(msg):
    syslogout(msg, logLevel=syslog.LOG_ERR)

#################################
# Function name:
#   warn_log
#
# Function overview:
#   Output to the syslog(LOG_WARNING level)
#
# Argument:
#   msg : Message string
#
# Return value:
#   None
#
################################# 
开发者ID:ntt-sic,项目名称:masakari,代码行数:19,代码来源:libvirt_eventfilter.py

示例2: loadDispositionModes

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def loadDispositionModes(self):
        Config = ConfigParser.ConfigParser()
        try:
            Config.read(self.configFileLoc)
            DispositionModes = Config.items('DispositionMode')
            for DispositionMode in DispositionModes:
                self.dispositionModes[DispositionMode[0]] = self._convertDispositionMode(DispositionMode[1])
                    
                    
        except ConfigParser.NoSectionError:
            if (self.loadAttempt >= self.maxLoadAttempts):
                log = "Error loading Config File for DispositionMode config, USING DEFAULTS"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
            else:
                self.loadError = True
                log = "Error loading Config File for DispositionMode config, should try again"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log))) 
开发者ID:lmco,项目名称:laikaboss,代码行数:21,代码来源:laikamilter.py

示例3: loadScanServers

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def loadScanServers(self):
        Config = ConfigParser.ConfigParser()
        try:
            Config.read(self.configFileLoc)
            servers = Config.items('ScanServers')
            for server in servers:
                self.servers.append(server[1])
        except ConfigParser.NoSectionError:
            if (self.loadAttempt >= self.maxLoadAttempts):
                log = "Error loading Config File for ScanServers config, USING DEFAULTS"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
            else:
                self.loadError = True
                log = "Error loading Config File for ScanServers config, should try again"
                logger = log2syslog(self.milterName, syslog.LOG_LOCAL0)
                logger.writeLog(syslog.LOG_ERR, "%s"%(str(log))) 
开发者ID:lmco,项目名称:laikaboss,代码行数:19,代码来源:laikamilter.py

示例4: LogError

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def LogError(msg):
    syslog.syslog(syslog.LOG_LOCAL3 | syslog.LOG_ERR, msg) 
开发者ID:googlearchive,项目名称:container-agent,代码行数:4,代码来源:run_containers.py

示例5: log

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def log(program, function, msg, level="I", display=True):
    global LAST_SHOWN
    # open syslog
    syslog.openlog("system: %s %s:%s:" % (level, program, function))
    # set priority
    priority = syslog.LOG_INFO
    if level == "E":
        priority = syslog.LOG_ERR
    elif level == "W":
        priority = syslog.LOG_WARNING
    priority |= syslog.LOG_LOCAL4
    # write to syslog
    syslog.syslog(priority, msg)
    #
    # NOTE: showlog / showlog -f to check the logs
    #

    if display:
        program_display = " %s: " % program
        displayed = " "
        # If loglevel is anything else than I, add it to our tag
        if level != "I":
            displayed += "[%s] " % level
        displayed += utf8_str(msg)
        # print using FBInk (via cFFI)
        fbink.fbink_print(fbink.FBFD_AUTO, "%s\n%s" % (program_display, displayed), FBINK_CFG) 
开发者ID:barsanuphe,项目名称:librariansync,代码行数:28,代码来源:kindle_logging.py

示例6: error

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def error(msg):
    syslog.syslog(syslog.LOG_ERR, _encode(msg)) 
开发者ID:kdart,项目名称:pycopia,代码行数:4,代码来源:logging.py

示例7: loglevel_error

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def loglevel_error():
    loglevel(syslog.LOG_ERR) 
开发者ID:kdart,项目名称:pycopia,代码行数:4,代码来源:logging.py

示例8: test_error_severity

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def test_error_severity(self):
        alertlib.Alert('test message', severity=logging.ERROR).send_to_logs()
        self.assertEqual([(syslog.LOG_ERR, 'test message')],
                         self.sent_to_syslog) 
开发者ID:Khan,项目名称:alertlib,代码行数:6,代码来源:alertlib_test.py

示例9: test_format_colored_with_level_error

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def test_format_colored_with_level_error(self):
        self.message.level = syslog.LOG_ERR
        log = TailFormatter('({source}) - {message}', color=True).format(self.message)
        self.assertEquals(colored('(dummy.source) - dummy message', 'red'), log) 
开发者ID:globocom,项目名称:glog-cli,代码行数:6,代码来源:test_formats.py

示例10: test_get_log_level_from_code

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
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']) 
开发者ID:globocom,项目名称:glog-cli,代码行数:10,代码来源:test_formats.py

示例11: test_get_log_level_code

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
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')) 
开发者ID:globocom,项目名称:glog-cli,代码行数:10,代码来源:test_formats.py

示例12: Close_valve

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def Close_valve():
    Alert("Closing the RO/DI valve", syslog.LOG_NOTICE)
    try:
        urllib2.urlopen("http://192.168.0.150/set.cmd?user=admin+pass=12345678+cmd=setpower+p61=0", timeout = 10)
        time.sleep(5)
    except urllib2.URLError as e:
        Send_alert("Cannot communicate with valve: " + type(e), syslog.LOG_ERR) 
开发者ID:aquamonitor,项目名称:Aquamonitor,代码行数:9,代码来源:rodi-1.8.py

示例13: Refilling

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def Refilling():
    try:
        response = urllib2.urlopen("http://192.168.0.150/set.cmd?user=admin+pass=12345678+cmd=getpower", timeout = 10)
        content = response.read()
        time.sleep(2)
        i = content[10]
        if int(i) == 1:
            return True
        else:
            return False
    except urllib2.URLError as e:
        Send_alert("Cannot communicate with valve: " + type(e), syslog.LOG_ERR) 
开发者ID:aquamonitor,项目名称:Aquamonitor,代码行数:14,代码来源:rodi-1.8.py

示例14: Open_valve

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def Open_valve():
    if Refilling() == True:
        Alert("RO/DI Valve already opened",syslog.LOG_WARNING)
        sys.exit(5)
    else:
        Alert("Opening the RO/DI valve",syslog.LOG_NOTICE)
        try:
            urllib2.urlopen("http://192.168.0.150/set.cmd?user=admin+pass=12345678+cmd=setpower+p61=1", timeout = 10)
            time.sleep(5)
        except urllib2.URLError as e:
            Send_alert("Cannot communicate with valve: " + type(e), syslog.LOG_ERR)
        time.sleep(VALVE_CHGSTATE_TIMER) 
开发者ID:aquamonitor,项目名称:Aquamonitor,代码行数:14,代码来源:rodi-1.8.py

示例15: Refilling

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def Refilling():
    try:
        response = urllib2.urlopen("http://192.168.0.150/set.cmd?user=admin+pass=12345678+cmd=getpower", timeout = 10)
        time.sleep(5)
        content = response.read()
        i = content[10]
        if int(i) == 1:
            return True
        else:
            return False
    except urllib2.URLError as e:
        print(Time() + "could not check IP power plug state, passing: " + str(e))
        Send_alert("Cannot communicate with valve: " + str(e), syslog.LOG_ERR)
        pass 
开发者ID:aquamonitor,项目名称:Aquamonitor,代码行数:16,代码来源:aquamonitor-1.8.py


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