本文整理汇总了Python中syslog.LOG_DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Python syslog.LOG_DEBUG属性的具体用法?Python syslog.LOG_DEBUG怎么用?Python syslog.LOG_DEBUG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类syslog
的用法示例。
在下文中一共展示了syslog.LOG_DEBUG属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: warn_log
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def warn_log(msg):
syslogout(msg, logLevel=syslog.LOG_WARNING)
#################################
# Function name:
# syslogout
#
# Function overview:
# Output to the syslog
#
# Argument:
# msg : Message string
# logLevel : Output level to syslog
# Default is LOG_DEBUG
#
# Return value:
# None
#
#################################
示例2: _dispositionMessage
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def _dispositionMessage(self):
self.startTimeZMQ = time.time()
if (not self._checkOKToContinueWithOpenFiles()):
self.disposition = "Over Process File Handle Limit"
self.logger.writeLog(syslog.LOG_ERR, "Disposition: %s"%(str(self.disposition)))
rtnToMTA = self.milterConfig.dispositionModes["OverLimit".lower()]
else:
dispositioner = Dispositioner(self.logger)
success = dispositioner.zmqGetFlagswithRetry(self.milterConfig.zmqMaxRetry, self)
self.disposition = dispositioner.strScanResult
self.scanPerformedOn = dispositioner.scanServerToUse
self.rulesMatched = ' '.join(dispositioner.match)
self.warnings = dispositioner.warnings
self.attachments = dispositioner.attachements
self._dispositionMessage_AttachmentHelper()
self.dispositions = dispositioner.dispositions
self.logger.writeLog(syslog.LOG_DEBUG, "%s Disposition: %s"%(self.uuid, str(dispositioner.dispositions)))
rtnToMTA = self._getReturnToMTAValue(dispositioner)
dispositioner.close()
self.endTimeZMQ = time.time()
return rtnToMTA
#_dispositionMessage_AttachmentHelper helps _dispositionMessage convert the attachment list to string.
示例3: test_emitCustomPriority
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
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')])
示例4: debug
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def debug(msg):
syslog.syslog(syslog.LOG_DEBUG, _encode(msg))
示例5: loglevel_debug
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def loglevel_debug():
loglevel(syslog.LOG_DEBUG)
示例6: test_format_colored_with_level_debug
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
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)
示例7: test_get_log_level_from_code
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [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'])
示例8: test_get_log_level_code
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [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'))
示例9: abort
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def abort(self):
try:
#Try sending it to EOM for scanning and disposition.
log = self.uuid+" Aborted QID: "+self.qid+" Attempting to send to direct to EOM"
self.logger.writeLog(syslog.LOG_DEBUG, "%s"%(str(log)))
self.eom()
except:
log = self.uuid+" Uncaught Exception in Abort"
self.logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
return Milter.CONTINUE
示例10: unknown
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def unknown(self, cmd):
log = self.uuid+" Unknown Callback Received: "+str(cmd)
self.logger.writeLog(syslog.LOG_DEBUG, "%s"%(str(log)))
return Milter.CONTINUE
# Start libmilter callbacks
示例11: hello
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def hello(self, heloname):
returnval = Milter.CONTINUE
try:
self.logger.writeLog(syslog.LOG_DEBUG, "%s hello:%s client_addr:%s if_addr:%s" %(self.uuid, str(heloname), str(self._getClientAddr()), str(self._getIfAddr())))
self.CUSTOMHELO = heloname
except:
log = self.uuid+" Uncaught Exception in Hello"
self.logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
return returnval
示例12: envfrom
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def envfrom(self,f,*str):
try:
if self.CUSTOMFROM != "": #If anything is left over from the last email, re -initialize.
self.__init__()
self.startTime = time.time()
self.startTimeDT = datetime.datetime.now()
if (self.milterConfig.mode == "shutdown"):
log = self.uuid+" Milter in Maint mode, returning [Sender:"+''.join(f)+"]"
self.logger.writeLog(syslog.LOG_DEBUG, "%s"%(log))
return self.milterConfig.dispositionModes["InMaintMode".lower()]
log = self.uuid+" envFrom: "
log += ''.join(f)
self.logger.writeLog(syslog.LOG_DEBUG, "%s"%(log))
self.CUSTOMFROM = f
self.CUSTOMFROM = self.CUSTOMFROM.replace("<", "")
self.CUSTOMFROM = self.CUSTOMFROM.replace(">", "")
self.sender = self.CUSTOMFROM
self.fph = StringIO.StringIO()
self.fpb = StringIO.StringIO()
except:
log = self.uuid+" Uncaught Exception in EnvFrom"
self.logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
return Milter.CONTINUE #ALWAYS continue to gather the entire email
示例13: envrcpt
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def envrcpt(self,to,*str):
try:
self.CUSTOMORCPT.append(to)
log = self.uuid+" envRcpt: "
rcpt = ' '.join(self.CUSTOMORCPT)
log += rcpt
self.logger.writeLog(syslog.LOG_DEBUG, "%s"%(log))
self.receiver = rcpt
self.receiver = self.receiver.replace("<", "") # clean the first "<" off the string
self.receiver = self.receiver.replace(">", "")
except:
log = self.uuid+" Uncaught Exception in EnvRcpt"
self.logger.writeLog(syslog.LOG_ERR, "%s"%(str(log)))
return Milter.CONTINUE
示例14: _checkOKToContinueWithOpenFiles
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def _checkOKToContinueWithOpenFiles(self):
okToContinue = True
try:
pid = os.getpid()
try:
fd_dir=os.path.join('/proc/', str(pid), 'fd/')
except:
self.logger.writeLog(syslog.LOG_DEBUG, "Open Files: Problem With PID: "+str(pid))
numOpenFilesOutput = 0
for file in os.listdir(fd_dir):
numOpenFilesOutput += 1
if (int(numOpenFilesOutput) > int(self.milterConfig.maxFiles)):
self.logger.writeLog(syslog.LOG_ERR, "Open Files: "+str(numOpenFilesOutput)+", Returning "+str(self.milterConfig.dispositionModes["OverLimit".lower()])+" to avoid shutdown at "+str(self.milterConfig.maxFiles))
okToContinue = False
else:
self.logger.writeLog(syslog.LOG_DEBUG, self.milterConfig.milterInstance+" Open Files: "+str(numOpenFilesOutput)+ " of "+ str(self.milterConfig.maxFiles))
except ValueError:
self.logger.writeLog(syslog.LOG_ERR, "Value Error in checkOpenFiles")
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
print "ERROR EOM %s" % (repr(traceback.format_exception(exc_type, exc_value, exc_traceback)))
self.logger.writeLog(syslog.LOG_ERR, "Error in checkOpenFiles")
return okToContinue
#_dispositionMessage main helper function to open dispositioner class to disposition message.
示例15: _logDetails
# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_DEBUG [as 别名]
def _logDetails(self):
log = self.uuid+" Flags: %s" % self.rulesMatched
self.logger.writeLog(syslog.LOG_DEBUG, "%s"%(str(log)))