<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-3052036-8']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <title>Twiggy: A Pythonic Logger — Twiggy</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '0.4.4', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Twiggy" href="_static/opensearch.xml"/> <link rel="top" title="Twiggy" href="#" /> <link rel="next" title="Logging Messages" href="logging.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="logging.html" title="Logging Messages" accesskey="N">next</a> |</li> <li><a href="#">Twiggy v0.4.4 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="twiggy-a-pythonic-logger"> <h1>Twiggy: A Pythonic Logger<a class="headerlink" href="#twiggy-a-pythonic-logger" title="Permalink to this headline">¶</a></h1> <div class="section" id="who-what-when-where"> <h2>Who, What, When, Where<a class="headerlink" href="#who-what-when-where" title="Permalink to this headline">¶</a></h2> <p>Twiggy is a more Pythonic logger.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">log</span><span class="o">.</span><span class="n">name</span><span class="p">(</span><span class="s">'frank'</span><span class="p">)</span><span class="o">.</span><span class="n">fields</span><span class="p">(</span><span class="n">number</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">"hello {who}, it's a {0} day"</span><span class="p">,</span> <span class="s">'sunny'</span><span class="p">,</span> <span class="n">who</span><span class="o">=</span><span class="s">'world'</span><span class="p">)</span> <span class="go">INFO:frank:number=42:hello world, it's a sunny day</span> </pre></div> </div> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">author:</th><td class="field-body"><a class="reference external" href="http://i.wearpants.org">Peter Fein</a></td> </tr> <tr class="field"><th class="field-name">email:</th><td class="field-body"><a class="reference external" href="mailto:pfein%40pobox.com">pfein<span>@</span>pobox<span>.</span>com</a></td> </tr> <tr class="field"><th class="field-name">homepage:</th><td class="field-body"><a class="reference external" href="http://twiggy.wearpants.org/">http://twiggy.wearpants.org/</a></td> </tr> <tr class="field"><th class="field-name">hosting:</th><td class="field-body"><a class="reference external" href="http://hg.wearpants.org/twiggy/">http://hg.wearpants.org/twiggy/</a></td> </tr> <tr class="field"><th class="field-name">IRC:</th><td class="field-body"><a class="reference external" href="http://irc.lc/freenode/wearpants/">irc://irc.freenode.net/#wearpants</a></td> </tr> <tr class="field"><th class="field-name">license:</th><td class="field-body"><a class="reference external" href="http://www.opensource.org/licenses/bsd-license.php">BSD</a></td> </tr> <tr class="field"><th class="field-name">Python:</th><td class="field-body">2.6</td> </tr> </tbody> </table> <p>Twiggy was born at <a class="reference external" href="http://us.pycon.org/2010/">Pycon 2010</a> after I whined about the standard library’s <a class="reference external" href="http://docs.python.org/library/logging.html">logging</a> and Jesse Noller “invited” me to do something about it.</p> <p>Install straight with distutils from the <a class="reference external" href="http://pypi.python.org/pypi/Twiggy">Cheeseshop</a> or:</p> <div class="highlight-python"><pre>pip install Twiggy easy_install -U Twiggy</pre> </div> <p>Get the latest version:</p> <div class="highlight-python"><pre>hg clone http://hg.wearpants.org/twiggy twiggy</pre> </div> </div> <div class="section" id="why-twiggy-should-be-your-new-logger"> <h2>Why Twiggy Should Be Your New Logger<a class="headerlink" href="#why-twiggy-should-be-your-new-logger" title="Permalink to this headline">¶</a></h2> <p>You should use Twiggy because it is awesome. For more information, <a class="reference external" href="http://blog.wearpants.org/meet-twiggy">see this blog post</a>.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Twiggy works great, but is not rock solid (yet); do not use for nuclear power plants, spaceships or mortgage derivatives trading (not that it’d matter).</p> </div> </div> <div class="section" id="documentation"> <h2>Documentation<a class="headerlink" href="#documentation" title="Permalink to this headline">¶</a></h2> <div class="toctree-wrapper compound"> <ul> <li class="toctree-l1"><a class="reference internal" href="logging.html">Logging Messages</a><ul> <li class="toctree-l2"><a class="reference internal" href="logging.html#the-magic-log">The Magic log</a></li> <li class="toctree-l2"><a class="reference internal" href="logging.html#better-output">Better output</a></li> <li class="toctree-l2"><a class="reference internal" href="logging.html#structured-logging">Structured Logging</a></li> <li class="toctree-l2"><a class="reference internal" href="logging.html#partial-binding">Partial Binding</a></li> <li class="toctree-l2"><a class="reference internal" href="logging.html#sample-output">Sample Output</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuring Output</a><ul> <li class="toctree-l2"><a class="reference internal" href="configuration.html#quick-setup">Quick Setup</a></li> <li class="toctree-l2"><a class="reference internal" href="configuration.html#twiggy-setup-py">twiggy_setup.py</a></li> <li class="toctree-l2"><a class="reference internal" href="configuration.html#outputs">Outputs</a></li> <li class="toctree-l2"><a class="reference internal" href="configuration.html#formats">Formats</a></li> <li class="toctree-l2"><a class="reference internal" href="configuration.html#filtering-output">Filtering Output</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="reference_guide.html">Reference Guide</a><ul> <li class="toctree-l2"><a class="reference internal" href="reference_guide.html#dynamic-logging">Dynamic Logging</a></li> <li class="toctree-l2"><a class="reference internal" href="reference_guide.html#features">Features!</a></li> <li class="toctree-l2"><a class="reference internal" href="reference_guide.html#stays-out-of-your-way">Stays Out of Your Way</a></li> <li class="toctree-l2"><a class="reference internal" href="reference_guide.html#concurrency">Concurrency</a></li> <li class="toctree-l2"><a class="reference internal" href="reference_guide.html#use-by-libraries">Use by Libraries</a></li> <li class="toctree-l2"><a class="reference internal" href="reference_guide.html#tips-and-tricks">Tips And Tricks</a></li> <li class="toctree-l2"><a class="reference internal" href="reference_guide.html#technical-details">Technical Details</a></li> <li class="toctree-l2"><a class="reference internal" href="reference_guide.html#extending-twiggy">Extending Twiggy</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="api.html">API Reference</a><ul> <li class="toctree-l2"><a class="reference internal" href="api.html#module-twiggy">Global Objects</a></li> <li class="toctree-l2"><a class="reference internal" href="api.html#module-twiggy.features">Features</a></li> <li class="toctree-l2"><a class="reference internal" href="api.html#module-twiggy.filters">Filters</a></li> <li class="toctree-l2"><a class="reference internal" href="api.html#module-twiggy.formats">Formats</a></li> <li class="toctree-l2"><a class="reference internal" href="api.html#module-twiggy.levels">Levels</a></li> <li class="toctree-l2"><a class="reference internal" href="api.html#module-twiggy.lib">Library</a></li> <li class="toctree-l2"><a class="reference internal" href="api.html#logger">Logger</a></li> <li class="toctree-l2"><a class="reference internal" href="api.html#module-twiggy.message">Message</a></li> <li class="toctree-l2"><a class="reference internal" href="api.html#module-twiggy.outputs">Outputs</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="glossary.html">Glossary</a></li> <li class="toctree-l1"><a class="reference internal" href="changelog.html">Changelog</a><ul> <li class="toctree-l2"><a class="reference internal" href="changelog.html#id1">0.4.4</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog.html#id2">0.4.3</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog.html#id3">0.4.2</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog.html#id4">0.4.1</a></li> <li class="toctree-l2"><a class="reference internal" href="changelog.html#id5">0.4.0</a></li> </ul> </li> </ul> </div> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <p class="logo"><a href="#"> <img class="logo" src="_static/twig_sidebar.jpg" alt="Logo"/> </a></p> <h3><a href="#">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Twiggy: A Pythonic Logger</a><ul> <li><a class="reference internal" href="#who-what-when-where">Who, What, When, Where</a></li> <li><a class="reference internal" href="#why-twiggy-should-be-your-new-logger">Why Twiggy Should Be Your New Logger</a></li> <li><a class="reference internal" href="#documentation">Documentation</a><ul> </ul> </li> </ul> </li> </ul> <h4>Next topic</h4> <p class="topless"><a href="logging.html" title="next chapter">Logging Messages</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/index.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="logging.html" title="Logging Messages" >next</a> |</li> <li><a href="#">Twiggy v0.4.4 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2010, <a href="http://i.wearpants.org">Peter Fein</a>. Last updated on Jul 10, 2012. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. </div> </body> </html>