本文整理汇总了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
#
#################################
示例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)))
示例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)))
示例4: LogError
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def LogError(msg):
syslog.syslog(syslog.LOG_LOCAL3 | syslog.LOG_ERR, msg)
示例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)
示例6: error
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def error(msg):
syslog.syslog(syslog.LOG_ERR, _encode(msg))
示例7: loglevel_error
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_ERR [as 别名]
def loglevel_error():
loglevel(syslog.LOG_ERR)
示例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)
示例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)
示例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'])
示例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'))
示例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)
示例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)
示例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)
示例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