MXNet

API

 mxnet / mxnet.log


mxnet.log

Logging utilities.

Functions

getLogger([name, filename, filemode, level])

Gets a customized logger.

get_logger([name, filename, filemode, level])

Gets a customized logger.

mxnet.log.getLogger(name=None, filename=None, filemode=None, level=30)[source]

Gets a customized logger.

Note

getLogger is deprecated. Use get_logger instead.

mxnet.log.get_logger(name=None, filename=None, filemode=None, level=30)[source]

Gets a customized logger.

Parameters
  • name (str, optional) – Name of the logger.

  • filename (str, optional) – The filename to which the logger’s output will be sent.

  • filemode (str, optional) – The file mode to open the file (corresponding to filename), default is ‘a’ if filename is not None.

  • level (int, optional) – The logging level for the logger. See: https://docs.python.org/2/library/logging.html#logging-levels

Returns

A customized Logger object.

Return type

Logger

Example

## get_logger call with default parameters. >>> from mxnet.log import get_logger >>> logger = get_logger(“Test”) >>> logger.warn(“Hello World”) W0505 00:29:47 3525 <stdin>:<module>:1] Hello World

## get_logger call with WARNING level. >>> import logging >>> logger = get_logger(“Test2”, level=logging.WARNING) >>> logger.warn(“Hello World”) W0505 00:30:50 3525 <stdin>:<module>:1] Hello World >>> logger.debug(“Hello World”) # This doesn’t return anything as the level is logging.WARNING.

## get_logger call with DEBUG level. >>> logger = get_logger(“Test3”, level=logging.DEBUG) >>> logger.debug(“Hello World”) # Logs the debug output as the level is logging.DEBUG. D0505 00:31:30 3525 <stdin>:<module>:1] Hello World


此页内容是否对您有帮助