Python Standard Logging in Sugar: Difference between revisions

From OLPC
Jump to navigation Jump to search
(New page: === How do I write to a log in my activity code? === Sugar uses [http://www.onlamp.com/pub/a/python/2005/06/02/logging.html python's standard logging]. The following code shows how to outp...)
 
No edit summary
Line 1: Line 1:
=== How do I write to a log in my activity code? ===
=== How do I write to a log in my activity code? ===
Sugar uses [http://www.onlamp.com/pub/a/python/2005/06/02/logging.html python's standard logging]. The following code shows how to output something at the debug log level.
Sugar uses [http://www.onlamp.com/pub/a/python/2005/06/02/logging.html 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
import logging

Revision as of 14: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')