MCPcopy Index your code
hub / github.com/python/cpython / __init__

Method __init__

Lib/logging/__init__.py:1197–1222  ·  view source on GitHub ↗

Open the specified file and use it as the stream for logging.

(self, filename, mode='a', encoding=None, delay=False, errors=None)

Source from the content-addressed store, hash-verified

1195 A handler class which writes formatted logging records to disk files.
1196 """
1197 def __init__(self, filename, mode='a', encoding=None, delay=False, errors=None):
1198 """
1199 Open the specified file and use it as the stream for logging.
1200 """
1201 # Issue #27493: add support for Path objects to be passed in
1202 filename = os.fspath(filename)
1203 #keep the absolute path, otherwise derived classes which use this
1204 #may come a cropper when the current directory changes
1205 self.baseFilename = os.path.abspath(filename)
1206 self.mode = mode
1207 self.encoding = encoding
1208 if "b" not in mode:
1209 self.encoding = io.text_encoding(encoding)
1210 self.errors = errors
1211 self.delay = delay
1212 # bpo-26789: FileHandler keeps a reference to the builtin open()
1213 # function to be able to open or reopen the file during Python
1214 # finalization.
1215 self._builtin_open = open
1216 if delay:
1217 #We don't open the stream, but we still need to call the
1218 #Handler constructor to set level, formatter, lock etc.
1219 Handler.__init__(self)
1220 self.stream = None
1221 else:
1222 StreamHandler.__init__(self, self._open())
1223
1224 def close(self):
1225 """

Callers

nothing calls this directly

Calls 3

_openMethod · 0.95
abspathMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected