colossalai.logging

colossalai.logging.get_dist_logger(name='colossalai')

Get logger instance based on name. The DistributedLogger will create singleton instances, which means that only one logger instance is created per name.

Parameters

name (str) – name of the logger, name must be unique

Returns

a distributed logger instance

Return type

colossalai.logging.DistributedLogger

class colossalai.logging.DistributedLogger(name)

This is a distributed event logger class essentially based on logging.

Parameters

name (str) – The name of the logger

static get_instance(name)

Get the unique single logger instance based on name. :param name: The name of the logger :type name: str :return: a DistributedLogger object :rtype: DistributedLogger

set_level(level)

Set the logging level :param level: can only be INFO, DEBUG, WARNING and ERROR :type level: str

log_to_file(path, mode='a', level='INFO', suffix=None)

Save the logs to file :param path: the file to save the log :type path: a string or pathlib.Path object :param mode: the mode to write log into the file :type mode: str :param level: can only be INFO, DEBUG, WARNING and ERROR :type level: str

info(message, parallel_mode=ParallelMode.GLOBAL, ranks=None)

Log an info message.

Parameters
  • message

  • parallel_mode

  • ranks

warning(message, parallel_mode=ParallelMode.GLOBAL, ranks=None)

Log a warning message.

Parameters
debug(message, parallel_mode=ParallelMode.GLOBAL, ranks=None)

Log a debug message.

Parameters
error(message, parallel_mode=ParallelMode.GLOBAL, ranks=None)

Log an error message.

Parameters