(self, filename, mode='a', encoding=None, delay=False, errors=None)
Open the specified file and use it as the stream for logging.
Open the specified file and use it as the stream for logging.
Open the specified file and use it as the stream for logging .
def __init__(self, filename, mode='a', encoding=None, delay=False, errors=None):
        """
        Open the specified file and use it as the stream for logging.
        """
        # Issue #27493: add support for Path objects to be passed in
        filename = os.fspath(filename)
        #keep the absolute path, otherwise derived classes which use this
        #may come a cropper when the current directory changes
        self.baseFilename = os.path.abspath(filename)
        self.mode = mode
        self.encoding = encoding
        if "b" not in mode:
            self.encoding = io.text_encoding(encoding)
        self.errors = errors
        self.delay = delay
        # bpo-26789: FileHandler keeps a reference to the builtin open()
        # function to be able to open or reopen the file during Python
        # finalization.
        self._builtin_open = open
        if delay:
            #We don't open the stream, but we still need to call the
            #Handler constructor to set level, formatter, lock etc.
            Handler.__init__(self)
            self.stream = None
        else:
            StreamHandler.__init__(self, self._open())
def __init__ ( self , filename , mode = 'a' , encoding = None , delay = False , errors = None ) : # Issue #27493: add support for Path objects to be passed in filename = os . fspath ( filename ) #keep the absolute path, otherwise derived classes which use this #may come a cropper when the current directory changes self . baseFilename = os . path . abspath ( filename ) self . mode = mode self . encoding = encoding if "b" not in mode : self . encoding = io . text_encoding ( encoding ) self . errors = errors self . delay = delay # bpo-26789: FileHandler keeps a reference to the builtin open() # function to be able to open or reopen the file during Python # finalization. self . _builtin_open = open if delay : #We don't open the stream, but we still need to call the #Handler constructor to set level, formatter, lock etc. Handler . __init__ ( self ) self . stream = None else : StreamHandler . __init__ ( self , self . _open ( ) )