(self, msg)
| 60 | self.log_file = open(log_path, 'a+') |
| 61 | |
| 62 | def log(self, msg): |
| 63 | formatted = '[{}] {}'.format( |
| 64 | datetime.datetime.now().replace(microsecond=0).isoformat(), |
| 65 | msg) |
| 66 | print(formatted) |
| 67 | if self.log_file: |
| 68 | self.log_file.write(formatted + '\n') |
| 69 | if self.reopen_to_flush: |
| 70 | log_path = self.log_file.name |
| 71 | self.log_file.close() |
| 72 | self.log_file = open(log_path, 'a+') |
| 73 | else: |
| 74 | self.log_file.flush() |
| 75 | |
| 76 | class Trainer: |
| 77 | def __init__(self, logger, config): |
no test coverage detected