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


Python syslog.LOG_PID属性代码示例

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


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

示例1: safe_open

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

示例2: __init__

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

示例3: writeLog

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_PID [as 别名]
def writeLog(msg):

	"""Output a message to the console/Syslog depending on the host"""

	if os.name == "posix":
        	syslog.openlog(logoption=syslog.LOG_PID,facility=syslog.LOG_MAIL)
        	syslog.syslog(msg)
	else:
		print msg
        return 
开发者ID:xme,项目名称:tweetsniff,代码行数:12,代码来源:tweetsniff.py

示例4: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_PID [as 别名]
def __init__(self, facility, options=syslog.LOG_PID):
    syslog.openlog(logoption=options, facility=facility)
    super().__init__() 
开发者ID:desbma,项目名称:hddfancontrol,代码行数:5,代码来源:__init__.py

示例5: __init__

# 需要导入模块: import syslog [as 别名]
# 或者: from syslog import LOG_PID [as 别名]
def __init__(self, facility=None, log_pid=True, log_perror=False,
                 **kwargs):
        """
        Initialize Syslog Object
        """
        super(NotifySyslog, self).__init__(**kwargs)

        if facility:
            try:
                self.facility = SYSLOG_FACILITY_MAP[facility]

            except KeyError:
                msg = 'An invalid syslog facility ' \
                      '({}) was specified.'.format(facility)
                self.logger.warning(msg)
                raise TypeError(msg)
        else:
            self.facility = \
                SYSLOG_FACILITY_MAP[
                    self.template_tokens['facility']['default']]

        # Logging Options
        self.logoptions = 0

        # Include PID with each message.
        # This may not appear evident if using journalctl since the pid
        # will always display itself; however it will appear visible
        # for log_perror combinations
        self.log_pid = log_pid

        # Print to stderr as well.
        self.log_perror = log_perror

        if log_pid:
            self.logoptions |= syslog.LOG_PID

        if log_perror:
            self.logoptions |= syslog.LOG_PERROR

        # Initialize our loggig
        syslog.openlog(
            self.app_id, logoption=self.logoptions, facility=self.facility)
        return 
开发者ID:caronc,项目名称:apprise,代码行数:45,代码来源:NotifySyslog.py


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