MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / _open

Method _open

fastdeploy/logger/handlers.py:322–342  ·  view source on GitHub ↗

open new log file

(self)

Source from the content-addressed store, hash-verified

320 return self.base_filename + "." + time.strftime(self.suffix, time.localtime())
321
322 def _open(self):
323 """
324 open new log file
325 """
326 if self.encoding is None:
327 stream = open(str(self.current_log_path), self.mode)
328 else:
329 stream = codecs.open(str(self.current_log_path), self.mode, self.encoding)
330
331 if self.base_log_path.exists():
332 try:
333 if not self.base_log_path.is_symlink() or os.readlink(self.base_log_path) != self.current_filename:
334 os.remove(self.base_log_path)
335 except OSError:
336 pass
337
338 try:
339 os.symlink(self.current_filename, str(self.base_log_path))
340 except OSError:
341 pass
342 return stream
343
344 def delete_expired_files(self):
345 """

Callers 1

doRolloverMethod · 0.95

Calls 1

existsMethod · 0.45

Tested by

no test coverage detected