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


Python syslog.openlog方法代码示例

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


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

示例1: main

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def main():
    if len(sys.argv) > 2:
        Fatal('usage: %s [containers.yaml]' % sys.argv[0])

    if len(sys.argv) == 2:
        with open(sys.argv[1], 'r') as fp:
            config = yaml.load(fp)
    else:
        config = yaml.load(sys.stdin)

    syslog.openlog(PROGNAME)
    LogInfo('processing container manifest')

    CheckVersion(config)

    all_volumes = LoadVolumes(config.get('volumes', []))
    user_containers = LoadUserContainers(config.get('containers', []),
                                         all_volumes)
    CheckGroupWideConflicts(user_containers)

    if user_containers:
        infra_containers = LoadInfraContainers(user_containers)
        RunContainers(infra_containers + user_containers) 
开发者ID:googlearchive,项目名称:container-agent,代码行数:25,代码来源:run_containers.py

示例2: safe_open

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def safe_open(self):
        try:
            syslog.openlog(self.app, syslog.LOG_PID)
        except Exception as e:
            print(e) 
开发者ID:sippy,项目名称:rtp_cluster,代码行数:7,代码来源:SipLogger.py

示例3: SendNotice

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def SendNotice(Message):

    try:

        syslog.openlog("genmon")
        syslog.syslog("%s" % Message)
        syslog.closelog()

    except Exception as e1:
        log.error("Error: " + str(e1))
        console.error("Error: " + str(e1))

#------------------- Command-line interface for gengpio ------------------------ 
开发者ID:jgyates,项目名称:genmon,代码行数:15,代码来源:gensyslog.py

示例4: log

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

示例5: main

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

示例6: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def __init__(self, threshold, sid=None, encoding='UTF-8'):
        import syslog
        AbstractLogger.__init__(self, threshold)
        if sid is None:
            sid = 'syslog'
        self.encoding = encoding
        syslog.openlog(sid, syslog.LOG_PID) 
开发者ID:jlachowski,项目名称:clonedigger,代码行数:9,代码来源:logger.py

示例7: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def __init__(self, facility=None):
        # Default values always get evaluated, for which reason we avoid
        # using 'syslog' directly, which may not be available.
        facility = facility if facility is not None else syslog.LOG_USER
        # Do not use super() unless type(logging.Handler) is 'type'
        # (i.e. >= Python 2.7).
        if not syslog:
            raise RuntimeError("Syslog not available on this platform")
        logging.Handler.__init__(self)
        binary_name = _get_binary_name()
        syslog.openlog(binary_name, 0, facility) 
开发者ID:openstack,项目名称:oslo.log,代码行数:13,代码来源:handlers.py

示例8: test_syslog_binary_name

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def test_syslog_binary_name(self):
        # There is no way to test the actual output written to the
        # syslog (e.g. /var/log/syslog) to confirm binary_name value
        # is actually present
        syslog.openlog = mock.Mock()
        handlers.OSSysLogHandler()
        syslog.openlog.assert_called_with(handlers._get_binary_name(),
                                          0, syslog.LOG_USER) 
开发者ID:openstack,项目名称:oslo.log,代码行数:10,代码来源:test_log.py

示例9: syslog_writer_before_all

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def syslog_writer_before_all(self, features):
        import syslog

        syslog.openlog("radish")
        syslog.syslog("begin run {}".format(self.marker)) 
开发者ID:radish-bdd,项目名称:radish,代码行数:7,代码来源:syslog_writer.py

示例10: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def __init__(self):
        """Initialize live parser"""
        self.parser = None
        self.parser_name = None
        self.event_type = None
        self.log_source = None
        syslog.openlog(facility=syslog.LOG_DAEMON) 
开发者ID:dogoncouch,项目名称:LogESP,代码行数:9,代码来源:parse.py

示例11: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def __init__(self, config='/opt/LogESP/config/parser.conf'):
        """Initialize live parser"""
        self.conf = config
        self.threads = []
        syslog.openlog(facility=syslog.LOG_DAEMON) 
开发者ID:dogoncouch,项目名称:LogESP,代码行数:7,代码来源:core.py

示例12: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def __init__(self):
        """Initialize daemon core object"""
        # Open our log facility:
        syslog.openlog(facility=syslog.LOG_DAEMON) 
开发者ID:dogoncouch,项目名称:LogESP,代码行数:6,代码来源:logespcore.py

示例13: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def __init__(self):
        """Initialize sentry core"""
        self.rule_types = {}
        self.threads = {}
        syslog.openlog(facility=syslog.LOG_DAEMON) 
开发者ID:dogoncouch,项目名称:LogESP,代码行数:7,代码来源:core.py

示例14: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def __init__(self):
        """Initialize trigger engine"""
        self.rlist = []
        self.rules = []
        self.newrules = []
        self.threads = {}
        syslog.openlog(facility=syslog.LOG_DAEMON) 
开发者ID:dogoncouch,项目名称:LogESP,代码行数:9,代码来源:core.py

示例15: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import openlog [as 别名]
def __init__(self, rule):
        """Initialize trigger object"""
        self.rule = rule
        self.tzone = TIME_ZONE
        self.lasteventid = None
        self.justfired = False
        self.timeint = timedelta(minutes=self.rule.time_int)
        syslog.openlog(facility=syslog.LOG_DAEMON) 
开发者ID:dogoncouch,项目名称:LogESP,代码行数:10,代码来源:list.py


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