open new log file
(self)
| 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 | """ |