-Welcome to your wiki! This is the default page we've installed for your convenience. Go ahead and edit it.
-This wiki uses the [[http://www.wikicreole.org/|Creole]] syntax, and is fully compatible with the 1.0 specification.
-The wiki itself is actually a hg repository, which means you can clone it, edit it locally/offline, add images or any other file type, and push it back to us. It will be live immediately.
+The console logger provides a nice interface for hierarchical output. Here's a trivial example to get us started.
-$ hg clone http://bitbucket.org/lars512/consolelog/wiki/
+>>> def some_function(n):
+... log = consoleLog.default
+... log.start('Counting to %d' % n, nSteps=n)
+... log.log('Item %d' % i)
-Wiki pages are normal files, with the .wiki extension. You can edit them locally, as well as creating new ones.
-=== Syntax highlighting ===
-You can also highlight snippets of text, we use the excellent [[http://www.pygments.org/|Pygments]] library.
-Here's an example of some Python code:
+This results in quite readable output. The real power is when logging calls are nested. The output then displays the full nesting hierarchy. You could do it like this:
- formatter = lambda t: "funky"+t
+from consoleLog import default as log
+ log.start('Making breakfast')
+ milk = get_milk(fridge)
+ food = milk.pour(museli)
-You can check out the source of this page to see how that's done, and make sure to bookmark [[http://pygments.org/docs/lexers/|the vast library of Pygment lexers]], we accept the 'short name' or the 'mimetype' of anything in there.
+In this example, we don't know how many steps are involved in making breakfast. We just tell the logger when it starts and when it's finished. If any of the functions we call, such as open_fridge() logs any actions, then they will appear nested under "Making breakfast". If any of them use log.start or log.finish methods, these sub-lists will also be nested appropriately.