本文整理匯總了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