mycroft.util.log

Mycroft Logging module.

This module provides the LOG pseudo function quickly creating a logger instance for use.

The default log level of the logger created here can ONLY be set in /etc/mycroft/mycroft.conf or ~/.mycroft/mycroft.conf

The default log level can also be programatically be changed by setting the LOG.level parameter.

class mycroft.util.log.LOG(name)[source]

Custom logger class that acts like logging.Logger The logger name is automatically generated by the module of the caller

Usage:
>>> LOG.debug('My message: %s', debug_str)
13:12:43.673 - :<module>:1 - DEBUG - My message: hi
>>> LOG('custom_name').debug('Another message')
13:13:10.462 - custom_name - DEBUG - Another message
classmethod debug(*args, **kwargs)

Log ‘msg % args’ with severity ‘DEBUG’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.debug(“Houston, we have a %s”, “thorny problem”, exc_info=1)

classmethod error(*args, **kwargs)

Log ‘msg % args’ with severity ‘ERROR’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.error(“Houston, we have a %s”, “major problem”, exc_info=1)

classmethod exception(*args, **kwargs)

Convenience method for logging an ERROR with exception information.

classmethod info(*args, **kwargs)

Log ‘msg % args’ with severity ‘INFO’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.info(“Houston, we have a %s”, “interesting problem”, exc_info=1)

classmethod init()[source]

Initializes the class, sets the default log level and creates the required handlers.

classmethod warning(*args, **kwargs)

Log ‘msg % args’ with severity ‘WARNING’.

To pass exception information, use the keyword argument exc_info with a true value, e.g.

logger.warning(“Houston, we have a %s”, “bit of a problem”, exc_info=1)

mycroft.util.log.getLogger(name='MYCROFT')[source]

Depreciated. Use LOG instead