Exemplo n.º 1
0
def logger_handler(logger_: logging.Logger, handler: logging.Handler):
    logger_.addHandler(handler)
    try:
        yield None
    finally:
        handler.close()
        logger_.removeHandler(handler)
Exemplo n.º 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)
Exemplo n.º 3
0
 def close(self, timeout=None):
     Handler.close(self)
     try:
         self.producter.flush(timeout)
     except Exception:
         pass
     self.producter.close(timeout)
Exemplo n.º 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()
Exemplo n.º 5
0
 def close(self):
     self.flush()
     self.acquire()
     try:
         self.target = NullHandler()
         Handler.close(self)
     finally:
         self.release()
Exemplo n.º 6
0
 def close(self):
     """
     Closes the stream.
     """
     if not self.stream.closed:
         self.stream.flush()
         self.stream.close()
     Handler.close(self)
Exemplo n.º 7
0
 def close(self):
     try:
         self._close()
         if not self.stream_lock.closed:
             self.stream_lock.close()
     finally:
         self.stream_lock = None
         Handler.close(self)
Exemplo n.º 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)
Exemplo n.º 9
0
 def close(self):
     """
     Closes the stream.
     """
     if not self.stream.closed:
         self.stream.flush()
         self.stream.close()
     Handler.close(self)
Exemplo n.º 10
0
 def close(self):
     self.target = None
     self.buffer = []
     self.acquire()
     try:
         Handler.close(self)
     finally:
         self.release()
Exemplo n.º 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)
Exemplo n.º 12
0
 def close(self):
     self.flush()
     self.acquire()
     try:
         self.target = NullHandler()
         Handler.close(self)
     finally:
         self.release()
Exemplo n.º 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()
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 20
0
 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)
Exemplo n.º 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()
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 24
0
Arquivo: log.py Projeto: 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)
Exemplo n.º 25
0
 def close(self):
     """Tidy up before removing from list of handlers"""
     self.logMessages = {}
     Handler.close(self)
Exemplo n.º 26
0
 def close(self):
     Handler.close(self)
     syslog.closelog()
Exemplo n.º 27
0
 def close(self):
     r"""
     """
     Handler.close(self)
Exemplo n.º 28
0
 def close(self):
     Handler.close(self)
     syslog.closelog()
 def close(self):
     self._handler.close()
     LogHandler.close(self)
Exemplo n.º 30
0
 def closeHandler(oldHandler: logging.Handler):
     oldHandler.flush()
     oldHandler.close()
     rootLogger.removeHandler(oldHandler)
Exemplo n.º 31
0
 def close(self):
     print("SocketIOHandler close called!")
     Handler.close(self)
     self.socketio_client.close()
Exemplo n.º 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)