Difference between revisions of "Development Team/Almanac/Python Standard Logging"

From Sugar Labs
Jump to navigation Jump to search
(No difference)

Revision as of 10:55, 9 July 2008

How do I write to a log in my activity code?

Sugar uses python's standard logging. The following code shows how to output something at the debug log level. The log message will be written to the standard log output destination (usually the console).

   import logging
   _logger = logging.getLogger('annotate-activity')
   ...
        _logger.debug('starting activity')