Python syslog.LOG_PID Examples
The following are 7
code examples of syslog.LOG_PID().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
syslog
, or try the search function
.
Example #1
Source File: SipLogger.py From rtp_cluster with BSD 2-Clause "Simplified" License | 5 votes |
def safe_open(self): try: syslog.openlog(self.app, syslog.LOG_PID) except Exception as e: print(e)
Example #2
Source File: SipLogger.py From b2bua with BSD 2-Clause "Simplified" License | 5 votes |
def safe_open(self): try: syslog.openlog(self.app, syslog.LOG_PID) except Exception as e: print(e)
Example #3
Source File: logger.py From clonedigger with GNU General Public License v3.0 | 5 votes |
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)
Example #4
Source File: tweetsniff.py From tweetsniff with GNU General Public License v3.0 | 5 votes |
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
Example #5
Source File: __init__.py From hddfancontrol with GNU General Public License v3.0 | 5 votes |
def __init__(self, facility, options=syslog.LOG_PID): syslog.openlog(logoption=options, facility=facility) super().__init__()
Example #6
Source File: NotifySyslog.py From apprise with MIT License | 4 votes |
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
Example #7
Source File: NotifySyslog.py From bazarr with GNU General Public License v3.0 | 4 votes |
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