Python Standard Logging in Sugar: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
=== What is the overall structure of python standard logging that I will use in Sugar? ===
=== What is the overall structure of python standard logging that I will use in Sugar? ===


Sugar uses Python's <ref>[http://www.onlamp.com/pub/a/python/2005/06/02/logging.html Standard Logging]</ref> pretty much without modification.
Sugar uses Python's Standard Logging<ref>[http://www.onlamp.com/pub/a/python/2005/06/02/logging.html OnLamp.com-- Python Standard Logging]</ref><ref>Python Library Reference -- [http://docs.python.org/lib/module-logging.html Logging] pretty much without modification. The diagram below conceptualizes how logging generally works.


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

Revision as of 15:52, 9 July 2008

What is the overall structure of python standard logging that I will use in Sugar?

Sugar uses Python's Standard Logging<ref>OnLamp.com-- Python Standard Logging</ref><ref>Python Library Reference -- Logging pretty much without modification. The diagram below conceptualizes how logging generally works.

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')

Notes

<references />