This file is indexed.

/usr/share/doc/python-logbook-doc/html/compat.html is in python-logbook-doc 0.12.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!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" />
    
    <title>Logging Compatibility &mdash; Logbook</title>
    
    <link rel="stylesheet" href="_static/sheet.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.12.3',
        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="top" title="Logbook" href="index.html" />
    <link rel="next" title="API Documentation" href="api/index.html" />
    <link rel="prev" title="Logging to Tickets" href="ticketing.html" />


  </head>
  <body role="document">
  <div class="book">
    <div class="banner">
      <a href="index.html">
        <!-- <img src="_static/" alt="Logbook logo"></img> -->
        <h1>Logbook </h1>
      </a>
    </div>

    <div class="related" role="navigation" aria-label="related navigation">
      <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="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="api/index.html" title="API Documentation"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="ticketing.html" title="Logging to Tickets"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Logbook 0.12.3</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
          <div class="body" role="main">
            
  <div class="section" id="logging-compatibility">
<span id="logging-compat"></span><h1>Logging Compatibility</h1>
<p>Logbook provides backwards compatibility with the logging library.  When
activated, the logging library will transparently redirect all the logging calls
to your Logbook logging setup.</p>
<div class="section" id="basic-setup">
<h2>Basic Setup</h2>
<p>If you import the compat system and call the
<a class="reference internal" href="api/compat.html#logbook.compat.redirect_logging" title="logbook.compat.redirect_logging"><code class="xref py py-func docutils literal"><span class="pre">redirect_logging()</span></code></a> function, all logging calls that happen
after this call will transparently be redirected to Logbook:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">logbook.compat</span> <span class="kn">import</span> <span class="n">redirect_logging</span>
<span class="n">redirect_logging</span><span class="p">()</span>
</pre></div>
</div>
<p>This also means you don&#8217;t have to call <a class="reference external" href="/usr/share/doc/python2.7/html/library/logging.html#logging.basicConfig" title="(in Python v2.7)"><code class="xref py py-func docutils literal"><span class="pre">logging.basicConfig()</span></code></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">logbook.compat</span> <span class="kn">import</span> <span class="n">redirect_logging</span><span class="p">,</span> <span class="n">StreamHandler</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sys</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">StreamHandler</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="p">)</span><span class="o">.</span><span class="n">push_application</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">redirect_logging</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="n">getLogger</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">log</span> <span class="o">=</span> <span class="n">getLogger</span><span class="p">(</span><span class="s">&#39;My Logger&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">log</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s">&#39;This is a warning&#39;</span><span class="p">)</span>
<span class="go">[2015-10-05 19:13:37.524346] WARNING: My Logger: This is a warning</span>
</pre></div>
</div>
</div>
<div class="section" id="advanced-setup">
<h2>Advanced Setup</h2>
<p>The way this is implemented is with a
<a class="reference internal" href="api/compat.html#logbook.compat.RedirectLoggingHandler" title="logbook.compat.RedirectLoggingHandler"><code class="xref py py-class docutils literal"><span class="pre">RedirectLoggingHandler</span></code></a>.  This class is a handler for
the old logging system that sends records via an internal logbook logger to the
active logbook handlers.  This handler can then be added to specific logging
loggers if you want:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">logging</span> <span class="kn">import</span> <span class="n">getLogger</span><span class="p">,</span> <span class="n">StreamHandler</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sys</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">StreamHandler</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="p">)</span><span class="o">.</span><span class="n">push_application</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">mylog</span> <span class="o">=</span> <span class="n">getLogger</span><span class="p">(</span><span class="s">&#39;My Log&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">logbook.compat</span> <span class="kn">import</span> <span class="n">RedirectLoggingHandler</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">mylog</span><span class="o">.</span><span class="n">addHandler</span><span class="p">(</span><span class="n">RedirectLoggingHandler</span><span class="p">())</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">otherlog</span> <span class="o">=</span> <span class="n">getLogger</span><span class="p">(</span><span class="s">&#39;Other Log&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">otherlog</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s">&#39;logging is deprecated&#39;</span><span class="p">)</span>
<span class="go">No handlers could be found for logger &quot;Other Log&quot;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">mylog</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s">&#39;but logbook is awesome&#39;</span><span class="p">)</span>
<span class="go">[2015-10-05 19:13:37.524346] WARNING: My Log: but logbook is awesome</span>
</pre></div>
</div>
</div>
<div class="section" id="reverse-redirects">
<h2>Reverse Redirects</h2>
<p>You can also redirect logbook records to logging, so the other way round.
For this you just have to activate the
<a class="reference internal" href="api/compat.html#logbook.compat.LoggingHandler" title="logbook.compat.LoggingHandler"><code class="xref py py-class docutils literal"><span class="pre">LoggingHandler</span></code></a> for the thread or application:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">logbook</span> <span class="kn">import</span> <span class="n">Logger</span>
<span class="kn">from</span> <span class="nn">logbook.compat</span> <span class="kn">import</span> <span class="n">LoggingHandler</span>

<span class="n">log</span> <span class="o">=</span> <span class="n">Logger</span><span class="p">(</span><span class="s">&#39;My app&#39;</span><span class="p">)</span>
<span class="k">with</span> <span class="n">LoggingHandler</span><span class="p">():</span>
    <span class="n">log</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s">&#39;Going to logging&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>


          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <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="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="api/index.html" title="API Documentation"
             >next</a> |</li>
        <li class="right" >
          <a href="ticketing.html" title="Logging to Tickets"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Logbook 0.12.3</a> &raquo;</li> 
      </ul>
    </div>

  
    <div class="footer" role="contentinfo">
        &copy; Copyright 2010, Armin Ronacher, Georg Brandl.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.3.
    </div>
  </div>

  </body>
</html>