我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用syslog.closelog()。
def close(self): syslog.syslog(syslog.LOG_INFO, 'Closing HSVerifyd') syslog.closelog()
def close(self): syslog.closelog() logging.Handler.close(self)
def __del__(self): syslog.closelog()
def close(self): syslog.syslog(syslog.LOG_INFO, 'Closing megadld') syslog.closelog()
def main(): args = docopt(__doc__, version="sdic {}".format(VERSION)) # Check that the given directory exists if not isdir(args['<directory>']): error("The folder {} does not exist".format(args['<directory>'])) # Try to get the config of the servers we are gonna use servers = get_servers_from_config(args['<directory>']) # Check that we are not already running program_name = os.path.basename(sys.argv[0]) lock = FileLock("/tmp/{}.lock".format(program_name)) if lock.is_locked(): error("{} is already running. Delete {} if it's a mistake.".format( program_name, lock.path)) # Everything's ok, run the main program with lock: syslog.openlog('sdic') has_output = False if not args['<server>']: for server in servers: if launch_queries(args['<directory>'], server): has_output = True else: for server in servers: if server['name'] == args['<server>']: if launch_queries(args['<directory>'], server): has_output = True if has_output: return 1 syslog.closelog()
def close(self): syslog.closelog() super(SysLogHandler, self).close()
def send_message(self, message="", **kwargs): """Send a message to a user.""" import syslog title = kwargs.get(ATTR_TITLE, ATTR_TITLE_DEFAULT) syslog.openlog(title, self._option, self._facility) syslog.syslog(self._priority, message) syslog.closelog()