Get the root logger. The logger will be initialized if it has not been initialized. By default a StreamHandler will be added. If `log_file` is specified, a FileHandler will also be added. The name of the root logger is the top-level package name, e.g., "easycv". Args: l
(log_file=None, log_level=logging.INFO)
| 7 | |
| 8 | |
| 9 | def get_root_logger(log_file=None, log_level=logging.INFO): |
| 10 | """Get the root logger. |
| 11 | |
| 12 | The logger will be initialized if it has not been initialized. By default a |
| 13 | StreamHandler will be added. If `log_file` is specified, a FileHandler will |
| 14 | also be added. The name of the root logger is the top-level package name, |
| 15 | e.g., "easycv". |
| 16 | |
| 17 | Args: |
| 18 | log_file (str | None): The log filename. If specified, a FileHandler |
| 19 | will be added to the root logger. |
| 20 | log_level (int): The root logger level. Note that only the process of |
| 21 | rank 0 is affected, while other processes will set the level to |
| 22 | "Error" and be silent most of the time. |
| 23 | |
| 24 | Returns: |
| 25 | logging.Logger: The root logger. |
| 26 | """ |
| 27 | return get_logger( |
| 28 | __name__.split('.')[0], log_file=log_file, log_level=log_level) |
| 29 | |
| 30 | |
| 31 | def print_log(msg, logger=None, level=logging.INFO): |
no outgoing calls