• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Custom log format support</title>
5<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Boost.Test">
8<link rel="up" href="../logging_api.html" title="Logging API">
9<link rel="prev" href="log_ct_log_format.html" title="Predefined log format selection">
10<link rel="next" href="../test_output_progress.html" title="Progress display">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="log_ct_log_format.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../logging_api.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../test_output_progress.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="boost_test.test_output.logging_api.custom_log_formatter"></a><a name="ref_log_formatter_api"></a><a class="link" href="custom_log_formatter.html" title="Custom log format support">Custom
28        log format support</a>
29</h4></div></div></div>
30<p>
31          It is possible to implement your own formatter: it should derive from
32          <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_formatter.html" title="Class unit_test_log_formatter">boost::unit_test::unit_test_log_formatter</a></code>.
33        </p>
34<p>
35          It is possible to add a your own instance of a formatter to the set of
36          formats using one of the two functions:
37        </p>
38<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">unit_test_log</span><span class="special">.</span><span class="identifier">set_formatter</span><span class="special">(</span> <span class="identifier">unit_test_log_formatter</span><span class="special">*</span> <span class="special">);</span>
39<span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">unit_test_log</span><span class="special">.</span><span class="identifier">add_formatter</span><span class="special">(</span> <span class="identifier">unit_test_log_formatter</span><span class="special">*</span> <span class="special">);</span>
40</pre>
41<div class="tip"><table border="0" summary="Tip">
42<tr>
43<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../../doc/src/images/tip.png"></td>
44<th align="left">Tip</th>
45</tr>
46<tr><td align="left" valign="top"><p>
47            See <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_t.html#idm45267286516176-bb">boost::unit_test::unit_test_log_t::set_formatter</a></code>
48            and <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_t.html#idm45267286508368-bb">boost::unit_test::unit_test_log_t::add_formatter</a></code>
49            for more details
50          </p></td></tr>
51</table></div>
52<div class="warning"><table border="0" summary="Warning">
53<tr>
54<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../../../doc/src/images/warning.png"></td>
55<th align="left">Warning</th>
56</tr>
57<tr><td align="left" valign="top"><p>
58            The call to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">unit_test_log</span><span class="special">.</span><span class="identifier">set_formatter</span></code> is equivalent to <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_t.html#idm45267286522816-bb">boost::unit_test::unit_test_log_t::set_format</a></code>
59            (<a class="link" href="log_ct_log_format.html" title="Predefined log format selection">see
60            here</a>) as it disables all other formatters.
61          </p></td></tr>
62</table></div>
63<div class="tip"><table border="0" summary="Tip">
64<tr>
65<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../../doc/src/images/tip.png"></td>
66<th align="left">Tip</th>
67</tr>
68<tr><td align="left" valign="top">
69<p>
70            More details about the class implementing the formatting of the logs
71            can be found in the following reference sections:
72          </p>
73<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
74<li class="listitem">
75                <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_formatter.html" title="Class unit_test_log_formatter">boost::unit_test::unit_test_log_formatter</a></code>
76                defines the interface for all loggers. Built-in <a class="link" href="../log_formats/log_human_readable_format.html" title="HRF: Human readable log format">HRF</a>,
77                <a class="link" href="../log_formats/log_xml_format.html" title="XML log format">XML</a>
78                and <a class="link" href="../log_formats/log_junit_format.html" title="JUNIT log format">JUNIT</a>
79                loggers derive from this class
80              </li>
81<li class="listitem">
82                <code class="computeroutput"><a class="link" href="../../../boost/unit_test/test_results.html" title="Class test_results">boost::unit_test::test_results</a></code>
83                defines the information carried by the tests to provide reports and
84                logs.
85              </li>
86</ul></div>
87</td></tr>
88</table></div>
89</div>
90<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
91<td align="left"></td>
92<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
93        Distributed under the Boost Software License, Version 1.0. (See accompanying
94        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
95      </p>
96</div></td>
97</tr></table>
98<hr>
99<div class="spirit-nav">
100<a accesskey="p" href="log_ct_log_format.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../logging_api.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../test_output_progress.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
101</div>
102</body>
103</html>
104