This file is indexed.

/usr/share/doc/python-logbook-doc/html/api/more.html is in python-logbook-doc 0.7.0-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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!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>The More Module &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.7.0',
        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="up" title="API Documentation" href="index.html" />
    <link rel="next" title="The Notifiers Module" href="notifiers.html" />
    <link rel="prev" title="Ticketing Support" href="ticketing.html" />


  </head>
  <body>
  <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">
      <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="notifiers.html" title="The Notifiers Module"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="ticketing.html" title="Ticketing Support"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Logbook 0.7.0</a> &raquo;</li>
          <li><a href="index.html" accesskey="U">API Documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
          <div class="body">
            
  <div class="section" id="the-more-module">
<h1>The More Module</h1>
<p>The more module implements special handlers and other things that are
beyond the scope of Logbook itself or depend on external libraries.
Additionally there are some handlers in <a class="reference internal" href="ticketing.html#module-logbook.ticketing" title="logbook.ticketing"><tt class="xref py py-mod docutils literal"><span class="pre">logbook.ticketing</span></tt></a>,
<a class="reference internal" href="queues.html#module-logbook.queues" title="logbook.queues"><tt class="xref py py-mod docutils literal"><span class="pre">logbook.queues</span></tt></a> and <a class="reference internal" href="notifiers.html#module-logbook.notifiers" title="logbook.notifiers"><tt class="xref py py-mod docutils literal"><span class="pre">logbook.notifiers</span></tt></a>.</p>
<span class="target" id="module-logbook.more"></span><div class="section" id="tagged-logging">
<h2>Tagged Logging</h2>
<dl class="class">
<dt id="logbook.more.TaggingLogger">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">TaggingLogger</tt><big>(</big><em>name=None</em>, <em>tags=None</em><big>)</big></dt>
<dd><p>A logger that attaches a tag to each record.  This is an alternative
record dispatcher that does not use levels but tags to keep log
records apart.  It is constructed with a descriptive name and at least
one tag.  The tags are up for you to define:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">logger</span> <span class="o">=</span> <span class="n">TaggingLogger</span><span class="p">(</span><span class="s">&#39;My Logger&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s">&#39;info&#39;</span><span class="p">,</span> <span class="s">&#39;warning&#39;</span><span class="p">])</span>
</pre></div>
</div>
<p>For each tag defined that way, a method appears on the logger with
that name:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&#39;This is a info message&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>To dispatch to different handlers based on tags you can use the
<a class="reference internal" href="#logbook.more.TaggingHandler" title="logbook.more.TaggingHandler"><tt class="xref py py-class docutils literal"><span class="pre">TaggingHandler</span></tt></a>.</p>
<p>The tags themselves are stored as list named <tt class="docutils literal"><span class="pre">'tags'</span></tt> in the
<a class="reference internal" href="base.html#logbook.LogRecord.extra" title="logbook.LogRecord.extra"><tt class="xref py py-attr docutils literal"><span class="pre">extra</span></tt></a> dictionary.</p>
<dl class="method">
<dt id="logbook.more.TaggingLogger.call_handlers">
<tt class="descname">call_handlers</tt><big>(</big><em>record</em><big>)</big></dt>
<dd><p>Pass a record to all relevant handlers in the following
order:</p>
<ul class="simple">
<li>per-dispatcher handlers are handled first</li>
<li>afterwards all the current context handlers in the
order they were pushed</li>
</ul>
<p>Before the first handler is invoked, the record is processed
(<a class="reference internal" href="#logbook.more.TaggingLogger.process_record" title="logbook.more.TaggingLogger.process_record"><tt class="xref py py-meth docutils literal"><span class="pre">process_record()</span></tt></a>).</p>
</dd></dl>

<dl class="method">
<dt id="logbook.more.TaggingLogger.handle">
<tt class="descname">handle</tt><big>(</big><em>record</em><big>)</big></dt>
<dd><p>Call the handlers for the specified record.  This is
invoked automatically when a record should be handled.
The default implementation checks if the dispatcher is disabled
and if the record level is greater than the level of the
record dispatcher.  In that case it will call the handlers
(<a class="reference internal" href="#logbook.more.TaggingLogger.call_handlers" title="logbook.more.TaggingLogger.call_handlers"><tt class="xref py py-meth docutils literal"><span class="pre">call_handlers()</span></tt></a>).</p>
</dd></dl>

<dl class="method">
<dt id="logbook.more.TaggingLogger.make_record_and_handle">
<tt class="descname">make_record_and_handle</tt><big>(</big><em>level</em>, <em>msg</em>, <em>args</em>, <em>kwargs</em>, <em>exc_info</em>, <em>extra</em><big>)</big></dt>
<dd><p>Creates a record from some given arguments and heads it
over to the handling system.</p>
</dd></dl>

<dl class="method">
<dt id="logbook.more.TaggingLogger.process_record">
<tt class="descname">process_record</tt><big>(</big><em>record</em><big>)</big></dt>
<dd><p>Processes the record with all context specific processors.  This
can be overriden to also inject additional information as necessary
that can be provided by this record dispatcher.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="logbook.more.TaggingHandler">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">TaggingHandler</tt><big>(</big><em>handlers</em>, <em>filter=None</em>, <em>bubble=False</em><big>)</big></dt>
<dd><p>A handler that logs for tags and dispatches based on those.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">logbook</span>
<span class="kn">from</span> <span class="nn">logbook.more</span> <span class="kn">import</span> <span class="n">TaggingHandler</span>

<span class="n">handler</span> <span class="o">=</span> <span class="n">TaggingHandler</span><span class="p">(</span><span class="nb">dict</span><span class="p">(</span>
    <span class="n">info</span><span class="o">=</span><span class="n">OneHandler</span><span class="p">(),</span>
    <span class="n">warning</span><span class="o">=</span><span class="n">AnotherHandler</span><span class="p">()</span>
<span class="p">))</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="special-handlers">
<h2>Special Handlers</h2>
<dl class="class">
<dt id="logbook.more.TwitterHandler">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">TwitterHandler</tt><big>(</big><em>consumer_key</em>, <em>consumer_secret</em>, <em>username</em>, <em>password</em>, <em>level=0</em>, <em>format_string=None</em>, <em>filter=None</em>, <em>bubble=False</em><big>)</big></dt>
<dd><p>A handler that logs to twitter.  Requires that you sign up an
application on twitter and request xauth support.  Furthermore the
oauth2 library has to be installed.</p>
<p>If you don&#8217;t want to register your own application and request xauth
credentials, there are a couple of leaked consumer key and secret
pairs from application explicitly whitelisted at Twitter
(<a class="reference external" href="http://bit.ly/leaked-secrets">leaked secrets</a>).</p>
<dl class="attribute">
<dt id="logbook.more.TwitterHandler.formatter_class">
<tt class="descname">formatter_class</tt></dt>
<dd><p>alias of <tt class="xref py py-class docutils literal"><span class="pre">TwitterFormatter</span></tt></p>
</dd></dl>

<dl class="method">
<dt id="logbook.more.TwitterHandler.get_oauth_token">
<tt class="descname">get_oauth_token</tt><big>(</big><big>)</big></dt>
<dd><p>Returns the oauth access token.</p>
</dd></dl>

<dl class="method">
<dt id="logbook.more.TwitterHandler.make_client">
<tt class="descname">make_client</tt><big>(</big><big>)</big></dt>
<dd><p>Creates a new oauth client auth a new access token.</p>
</dd></dl>

<dl class="method">
<dt id="logbook.more.TwitterHandler.tweet">
<tt class="descname">tweet</tt><big>(</big><em>status</em><big>)</big></dt>
<dd><p>Tweets a given status.  Status must not exceed 140 chars.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="logbook.more.ExternalApplicationHandler">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">ExternalApplicationHandler</tt><big>(</big><em>arguments</em>, <em>stdin_format=None</em>, <em>encoding='utf-8'</em>, <em>level=0</em>, <em>filter=None</em>, <em>bubble=False</em><big>)</big></dt>
<dd><p>This handler invokes an external application to send parts of
the log record to.  The constructor takes a list of arguments that
are passed to another application where each of the arguments is a
format string, and optionally a format string for data that is
passed to stdin.</p>
<p>For example it can be used to invoke the <tt class="docutils literal"><span class="pre">say</span></tt> command on OS X:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">logbook.more</span> <span class="kn">import</span> <span class="n">ExternalApplicationHandler</span>
<span class="n">say_handler</span> <span class="o">=</span> <span class="n">ExternalApplicationHandler</span><span class="p">([</span><span class="s">&#39;say&#39;</span><span class="p">,</span> <span class="s">&#39;{record.message}&#39;</span><span class="p">])</span>
</pre></div>
</div>
<p>Note that the above example is blocking until <tt class="docutils literal"><span class="pre">say</span></tt> finished, so it&#8217;s
recommended to combine this handler with the
<tt class="xref py py-class docutils literal"><span class="pre">logbook.ThreadedWrapperHandler</span></tt> to move the execution into
a background thread.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.3.</span></p>
</div>
</dd></dl>

<dl class="class">
<dt id="logbook.more.ExceptionHandler">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">ExceptionHandler</tt><big>(</big><em>exc_type</em>, <em>level=0</em>, <em>format_string=None</em>, <em>filter=None</em>, <em>bubble=False</em><big>)</big></dt>
<dd><p>An exception handler which raises exceptions of the given <cite>exc_type</cite>.
This is especially useful if you set a specific error <cite>level</cite> e.g. to treat
warnings as exceptions:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">logbook.more</span> <span class="kn">import</span> <span class="n">ExceptionHandler</span>

<span class="k">class</span> <span class="nc">ApplicationWarning</span><span class="p">(</span><span class="ne">Exception</span><span class="p">):</span>
    <span class="k">pass</span>

<span class="n">exc_handler</span> <span class="o">=</span> <span class="n">ExceptionHandler</span><span class="p">(</span><span class="n">ApplicationWarning</span><span class="p">,</span> <span class="n">level</span><span class="o">=</span><span class="s">&#39;WARNING&#39;</span><span class="p">)</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.3.</span></p>
</div>
</dd></dl>

<dl class="class">
<dt id="logbook.more.DedupHandler">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">DedupHandler</tt><big>(</big><em>format_string='message repeated {count} times: {message}'</em>, <em>*args</em>, <em>**kwargs</em><big>)</big></dt>
<dd><p>A handler that deduplicates log messages.</p>
<p>It emits each unique log record once, along with the number of times it was emitted.
Example::</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">with</span> <span class="n">logbook</span><span class="o">.</span><span class="n">more</span><span class="o">.</span><span class="n">DedupHandler</span><span class="p">():</span>
    <span class="n">logbook</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">)</span>
    <span class="n">logbook</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&#39;bar&#39;</span><span class="p">)</span>
    <span class="n">logbook</span><span class="o">.</span><span class="n">error</span><span class="p">(</span><span class="s">&#39;foo&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>The expected output::</p>
<div class="highlight-python"><div class="highlight"><pre>message repeated 2 times: foo
message repeated 1 times: bar
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="colorized-handlers">
<h2>Colorized Handlers</h2>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.3.</span></p>
</div>
<dl class="class">
<dt id="logbook.more.ColorizedStderrHandler">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">ColorizedStderrHandler</tt><big>(</big><em>level=0</em>, <em>format_string=None</em>, <em>filter=None</em>, <em>bubble=False</em><big>)</big></dt>
<dd><p>A colorizing stream handler that writes to stderr.  It will only
colorize if a terminal was detected.  Note that this handler does
not colorize on Windows systems.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.3.</span></p>
</div>
</dd></dl>

<dl class="class">
<dt id="logbook.more.ColorizingStreamHandlerMixin">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">ColorizingStreamHandlerMixin</tt></dt>
<dd><p>A mixin class that does colorizing.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.3.</span></p>
</div>
<dl class="method">
<dt id="logbook.more.ColorizingStreamHandlerMixin.get_color">
<tt class="descname">get_color</tt><big>(</big><em>record</em><big>)</big></dt>
<dd><p>Returns the color for this record.</p>
</dd></dl>

<dl class="method">
<dt id="logbook.more.ColorizingStreamHandlerMixin.should_colorize">
<tt class="descname">should_colorize</tt><big>(</big><em>record</em><big>)</big></dt>
<dd><p>Returns <cite>True</cite> if colorizing should be applied to this
record.  The default implementation returns <cite>True</cite> if the
stream is a tty and we are not executing on windows.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="other">
<h2>Other</h2>
<dl class="class">
<dt id="logbook.more.JinjaFormatter">
<em class="property">class </em><tt class="descclassname">logbook.more.</tt><tt class="descname">JinjaFormatter</tt><big>(</big><em>template</em><big>)</big></dt>
<dd><p>A formatter object that makes it easy to format using a Jinja 2
template instead of a format string.</p>
</dd></dl>

</div>
</div>


          </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="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="notifiers.html" title="The Notifiers Module"
             >next</a> |</li>
        <li class="right" >
          <a href="ticketing.html" title="Ticketing Support"
             >previous</a> |</li>
        <li><a href="../index.html">Logbook 0.7.0</a> &raquo;</li>
          <li><a href="index.html" >API Documentation</a> &raquo;</li> 
      </ul>
    </div>

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

  </body>
</html>