Chapter 14.6.2. Extended Logging

If you’ve used Python’s logging module at all, you’d probably guess that there’s more to MochiKit.Logging than just a log function. There is, indeed. For a great many applications, log (and some way to view the output) is all you need.

MochiKit.Logging supports different log levels, much like Python’s logging module. There are five logging levels defined: DEBUG, INFO, WARNING, ERROR, and FATAL. You can call a log<LEVEL>(msg) function, such as logDebug(msg), to log a message at a given level.

Logging levels can be helpful for visually identifying different kinds of messages as you’re skimming the log output. But, they become most useful when combined with a listener that does something special.

A simple ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.