Debian Codegraph @

doc/html/ext-logtoprocess.html

raw
1 <?xml version="1.0" encoding="utf-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" />
7 <title>logtoprocess</title>
8 <link rel="stylesheet" href="../style.css" type="text/css" />
9 </head>
10 <body>
11 <div class="document" id="logtoprocess">
12 <span id="ext-logtoprocess"></span>
13 <h1 class="title">logtoprocess</h1>
14
15 <div class="contents htmlonly topic" id="contents">
16 <p class="topic-title"><a class="reference internal" href="#top">Contents</a></p>
17 <ul class="simple">
18 <li><a class="reference internal" href="#description" id="toc-entry-1">Description</a></li>
19 </ul>
20 </div>
21 <p>send ui.log() data to a subprocess (EXPERIMENTAL)</p>
22 <div class="section" id="description">
23 <h1><a class="toc-backref" href="#contents">Description</a></h1>
24 <p>This extension lets you specify a shell command per ui.log() event,
25 sending all remaining arguments to as environment variables to that command.</p>
26 <p>Positional arguments construct a log message, which is passed in the <cite>MSG1</cite>
27 environment variables. Each keyword argument is set as a <cite>OPT_UPPERCASE_KEY</cite>
28 variable (so the key is uppercased, and prefixed with <cite>OPT_</cite>). The original
29 event name is passed in the <cite>EVENT</cite> environment variable, and the process ID
30 of mercurial is given in <cite>HGPID</cite>.</p>
31 <p>So given a call <cite>ui.log('foo', 'bar %s
32 ', 'baz', spam='eggs'), a script
33 configured for the `foo</cite> event can expect an environment with <cite>MSG1=bar baz</cite>,
34 and <cite>OPT_SPAM=eggs</cite>.</p>
35 <p>Scripts are configured in the <cite>[logtoprocess]</cite> section, each key an event name.
36 For example:</p>
37 <pre class="literal-block">
38 [logtoprocess]
39 commandexception = echo &quot;$MSG1&quot; &gt; /var/log/mercurial_exceptions.log
40 </pre>
41 <p>would log the warning message and traceback of any failed command dispatch.</p>
42 <p>Scripts are run asynchronously as detached daemon processes; mercurial will
43 not ensure that they exit cleanly.</p>
44 </div>
45 </div>
46 </body>
47 </html>