示例#1
0
def logger_handler(logger_: logging.Logger, handler: logging.Handler):
    logger_.addHandler(handler)
    try:
        yield None
    finally:
        handler.close()
        logger_.removeHandler(handler)
示例#2
0
 def close(self):
     if not self.stream.closed:
         self.stream.flush()
         self.stream.close()
     if not self.stream_lock.closed:
         self.stream_lock.close()
     Handler.close(self)
示例#3
0
 def close(self, timeout=None):
     Handler.close(self)
     try:
         self.producter.flush(timeout)
     except Exception:
         pass
     self.producter.close(timeout)
示例#4
0
def disable_commands_handler(handler: logging.Handler) -> None:
    """Disable special handler for commands.

    :param handler: Handler returned by enable_commands_handler
    """
    logging.getLogger().removeHandler(handler)
    handler.flush()
    handler.close()
示例#5
0
 def close(self):
     self.flush()
     self.acquire()
     try:
         self.target = NullHandler()
         Handler.close(self)
     finally:
         self.release()
示例#6
0
 def close(self):
     """
     Closes the stream.
     """
     if not self.stream.closed:
         self.stream.flush()
         self.stream.close()
     Handler.close(self)
示例#7
0
文件: logmgr.py 项目: JarodLi/obssftp
 def close(self):
     try:
         self._close()
         if not self.stream_lock.closed:
             self.stream_lock.close()
     finally:
         self.stream_lock = None
         Handler.close(self)
示例#8
0
 def close(self):
     """Flushes any remaining messages in the queue."""
     if self.messages_pending:
         try:
             self.scribe_write(self._log_buffer)
         except self.ScribeHandlerException:
             pass
     Handler.close(self)
 def close(self):
     """
     Closes the stream.
     """
     if not self.stream.closed:
         self.stream.flush()
         self.stream.close()
     Handler.close(self)
示例#10
0
 def close(self):
     self.target = None
     self.buffer = []
     self.acquire()
     try:
         Handler.close(self)
     finally:
         self.release()
示例#11
0
 def close(self):
   """Flushes any remaining messages in the queue."""
   if self.messages_pending:
     try:
       self.scribe_write(self._log_buffer)
     except self.ScribeHandlerException:
       pass
   Handler.close(self)
示例#12
0
 def close(self):
     self.flush()
     self.acquire()
     try:
         self.target = NullHandler()
         Handler.close(self)
     finally:
         self.release()
示例#13
0
    def close(self):
        """Close the producer and clean up."""
        self.acquire()
        try:
            if self.producer:
                self.producer.close()

            Handler.close(self)
        finally:
            self.release()
示例#14
0
 def close(self):
     """
     Closes the stream.
     """
     if self.stream and not self.stream.closed:
         self.stream.flush()
         self.stream.close()
     if self.stream_lock and not self.stream_lock.closed:
         self.stream_lock.close()
     Handler.close(self)
示例#15
0
    def close(self):
        self.acquire()
        try:
            if self.__conn and self.__conn.is_open:
                self.__conn.close()
                self.__conn = None
        finally:
            self.release()

        Handler.close(self)
示例#16
0
    def close(self):
        self.acquire()
        try:
            if self.__conn and self.__conn.is_open:
                self.__conn.close()
                self.__conn = None
        finally:
            self.release()

        Handler.close(self)
示例#17
0
 def close(self):
     try:
         self._close()
         if not self.stream_lock.closed:
             self.stream_lock.close()
     except AttributeError:
         pass
     finally:
         self.stream_lock = None
         Handler.close(self)
示例#18
0
 def close(self):
     """
     Close log stream and stream_lock. """
     self._console_log("In close()", stack=True)
     try:
         self._close()
     finally:
         self._do_file_unlock()
         self.stream_lock = None
         Handler.close(self)
 def close(self):
     """
     Close log stream and stream_lock. """
     try:
         self._close()
         if not self.stream_lock.closed:
             self.stream_lock.close()
     finally:
         self.stream_lock = None
         Handler.close(self)
示例#20
0
文件: cloghandler.py 项目: 2mny/mylar
 def close(self):
     """
     Close log stream and stream_lock. """
     try:
         self._close()
         if not self.stream_lock.closed:
             self.stream_lock.close()
     finally:
         self.stream_lock = None
         Handler.close(self)
示例#21
0
 def close(self):
     self.acquire()
     try:
         if self.stream:
             self.flush()
             self.stream.close()
             self.stream = None
             Handler.close(self)
     finally:
         self.release()
示例#22
0
    def remove_handler(self, name: str,
                       handler: python_logging.Handler) -> None:
        """Remove handler from module.

        Args:
            name: module name
            handler: Logging Handler
        """
        logger = python_logging.getLogger(name)
        handler.close()
        logger.removeHandler(handler)
示例#23
0
 def close(self):
     """
     Close log stream and stream_lock. """
     try:
         self._close()
         if hasattr(self.stream_lock, 'closed') and \
                 not self.stream_lock.closed:
             self.stream_lock.close()
     finally:
         self.stream_lock = None
         if Handler:
             Handler.close(self)
示例#24
0
文件: log.py 项目: wayhk/ARK
    def close(self):
        """
        关闭文件流,并释放锁

        :return : None
        """
        try:
            self._close()
            if not self.stream_lock.closed:
                self.stream_lock.close()
        finally:
            self.stream_lock = None
            Handler.close(self)
示例#25
0
 def close(self):
     """Tidy up before removing from list of handlers"""
     self.logMessages = {}
     Handler.close(self)
示例#26
0
 def close(self):
     Handler.close(self)
     syslog.closelog()
示例#27
0
 def close(self):
     r"""
     """
     Handler.close(self)
示例#28
0
 def close(self):
     Handler.close(self)
     syslog.closelog()
 def close(self):
     self._handler.close()
     LogHandler.close(self)
示例#30
0
 def closeHandler(oldHandler: logging.Handler):
     oldHandler.flush()
     oldHandler.close()
     rootLogger.removeHandler(oldHandler)
示例#31
0
 def close(self):
     print("SocketIOHandler close called!")
     Handler.close(self)
     self.socketio_client.close()
示例#32
0
 def close(self):
     """Tell the server we're done with the file. It will know to close the file once
     all clients are done with it."""
     Handler.close(self)
     self.client.done(self.client_id, self.filepath)