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


Python syslog.LOG_LOCAL4属性代码示例

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


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

示例1: log

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_LOCAL4 [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

示例2: main

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_LOCAL4 [as 别名]
def main():
    config = get_config_port_ip()
    list_live_ip(config)
    for i in config.keys():
        if arp(i) == config[i]:
            continue
        if arp(i) == 'none':
            syslog.openlog( 'WARNING', 0, syslog.LOG_LOCAL7 )
            syslog.syslog(syslog.LOG_ALERT, '%s %s IS NOT ACTIVE ' % (socket.gethostname(), i))
        else:
            syslog.openlog( 'WARNING', 0, syslog.LOG_LOCAL4 )
            syslog.syslog(syslog.LOG_ALERT, '%s %s IS IN WRONG PORT %s AND SHOULD BE IN %s ' % (socket.gethostname(), i, arp(i),config[i] )) 
开发者ID:networkingdvi,项目名称:HPN-Scripting,代码行数:14,代码来源:staticip.py

示例3: test_find_facility

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_LOCAL4 [as 别名]
def test_find_facility(self):
        self.assertEqual(syslog.LOG_USER,
                         output.Syslog._find_facility("user"))
        self.assertEqual(syslog.LOG_LOCAL1,
                         output.Syslog._find_facility("log_local1"))
        self.assertEqual(syslog.LOG_LOCAL2,
                         output.Syslog._find_facility("LOG_local2"))
        self.assertEqual(syslog.LOG_LOCAL3,
                         output.Syslog._find_facility("LOG_LOCAL3"))
        self.assertEqual(syslog.LOG_LOCAL4,
                         output.Syslog._find_facility("LOCaL4")) 
开发者ID:jd,项目名称:daiquiri,代码行数:13,代码来源:test_output.py


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