|
a |
|
b/mmaction/utils/logger.py |
|
|
1 |
# Copyright (c) OpenMMLab. All rights reserved. |
|
|
2 |
import logging |
|
|
3 |
|
|
|
4 |
from mmcv.utils import get_logger |
|
|
5 |
|
|
|
6 |
|
|
|
7 |
def get_root_logger(log_file=None, log_level=logging.INFO): |
|
|
8 |
"""Use ``get_logger`` method in mmcv to get the root logger. |
|
|
9 |
|
|
|
10 |
The logger will be initialized if it has not been initialized. By default a |
|
|
11 |
StreamHandler will be added. If ``log_file`` is specified, a FileHandler |
|
|
12 |
will also be added. The name of the root logger is the top-level package |
|
|
13 |
name, e.g., "mmaction". |
|
|
14 |
|
|
|
15 |
Args: |
|
|
16 |
log_file (str | None): The log filename. If specified, a FileHandler |
|
|
17 |
will be added to the root logger. |
|
|
18 |
log_level (int): The root logger level. Note that only the process of |
|
|
19 |
rank 0 is affected, while other processes will set the level to |
|
|
20 |
"Error" and be silent most of the time. |
|
|
21 |
|
|
|
22 |
Returns: |
|
|
23 |
:obj:`logging.Logger`: The root logger. |
|
|
24 |
""" |
|
|
25 |
return get_logger(__name__.split('.')[0], log_file, log_level) |