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

Method _open

fastdeploy/utils.py:314–334  ·  view source on GitHub ↗

open new log file

(self)

Source from the content-addressed store, hash-verified

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

Callers 1

doRolloverMethod · 0.95

Calls 1

existsMethod · 0.45

Tested by

no test coverage detected