Skip to content

Commit

Permalink
add more docs and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nbei committed Jan 31, 2021
1 parent d98cc2c commit d676fba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mmcv/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def get_logger(name, log_file=None, log_level=logging.INFO, file_mode='w'):
log_level (int): The logger level. Note that only the process of
rank 0 is affected, and other processes will set the level to
"Error" thus be silent most of the time.
file_mode (str): The file mode used in opening log file.
Defaults to 'w'.
Returns:
logging.Logger: The expected logger.
Expand All @@ -45,6 +47,9 @@ def get_logger(name, log_file=None, log_level=logging.INFO, file_mode='w'):

# only rank 0 will add a FileHandler
if rank == 0 and log_file is not None:
# Here, the default behaviour of the official logger is 'a'. Thus, we
# provide an interface to change the file mode to the default
# behaviour.
file_handler = logging.FileHandler(log_file, file_mode)
handlers.append(file_handler)

Expand Down

0 comments on commit d676fba

Please sign in to comment.