(self)
Flush, close possible files, and remove stdout/stderr mirroring.
Flush, close possible files, and remove stdout/stderr mirroring.
Flush close possible files and remove stdout / stderr mirroring .
def close(self) -> None:
        """Flush, close possible files, and remove stdout/stderr mirroring."""
        self.flush()

        # if using multiple loggers, prevent closing in wrong order
        if sys.stdout is self:
            sys.stdout = self.stdout
        if sys.stderr is self:
            sys.stderr = self.stderr

        if self.file is not None:
            self.file.close()
def close ( self ) -> None : self . flush ( ) # if using multiple loggers, prevent closing in wrong order if sys . stdout is self : sys . stdout = self . stdout if sys . stderr is self : sys . stderr = self . stderr if self . file is not None : self . file . close ( )