r"""Sets log output file. Args: fout: file-like object that supports write and flush, or string for the filename mode: specify the mode to open log file if *fout* is a string
(fout, mode="a")
| 13 | |
| 14 | |
| 15 | def set_log_file(fout, mode="a"): |
| 16 | r"""Sets log output file. |
| 17 | |
| 18 | Args: |
| 19 | fout: file-like object that supports write and flush, or string for the filename |
| 20 | mode: specify the mode to open log file if *fout* is a string |
| 21 | """ |
| 22 | if isinstance(fout, str): |
| 23 | fout = open(fout, mode) |
| 24 | MegEngineLogFormatter.log_fout = fout |
| 25 | |
| 26 | |
| 27 | class MegEngineLogFormatter(logging.Formatter): |