Logger object

Differents level are available : trace, debug, info, warning, error, critical.

Examples of usage:

from kivy.logger import Logger

Logger.info('title: This is a info')
Logger.debug('title: This is a debug')

try:
    raise Exception('bleh')
except Exception, e:
    Logger.exception(e)

The message passed to the logger is splited to the first :. The left part is used as a title, and the right part is used as a message. This way, you can “categorize” your message easily:

Logger.info('Application: This is a test')

# will appear as

[INFO   ] [Application ] This is a test

Logger configuration

Logger can be controled in the Kivy configuration file:

[kivy]
log_level = info
log_enable = 1
log_dir = logs
log_name = kivy_%y-%m-%d_%_.txt

More information about the allowed values is described in kivy.config module.

Logger history

Even if the logger is not enabled, you can still have the history of latest 100 messages:

from kivy.logger import LoggerHistory

print LoggerHistory.history
kivy.logger.Logger = <logging.Logger object at 0x735df0>

Kivy default logger instance

class kivy.logger.LoggerHistory(level=0)

Bases: logging.Handler

Kivy history handler