<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>openPilotLog: ALog Namespace Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="custom_dark_theme.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="icon_main.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">openPilotLog
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('namespace_a_log.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">ALog Namespace Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>The <a class="el" href="namespace_a_log.html" title="The ALog namespace encapsulates constants and functions used to provide logging to files and logging ...">ALog</a> namespace encapsulates constants and functions used to provide logging to files and logging to console (stdout)  
<a href="namespace_a_log.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a1eeade2b758f2d452e40426f8d37c41a"><td class="memItemLeft" align="right" valign="top"><a id="a1eeade2b758f2d452e40426f8d37c41a"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_a_log.html#a1eeade2b758f2d452e40426f8d37c41a">setLogFileName</a> ()</td></tr>
<tr class="memdesc:a1eeade2b758f2d452e40426f8d37c41a"><td class="mdescLeft">&#160;</td><td class="mdescRight">setLogFileName sets a log file name ("Log_&lt;Date&gt;_&lt;Time&gt;.txt") <br /></td></tr>
<tr class="separator:a1eeade2b758f2d452e40426f8d37c41a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae110fbae5b42a1dd106a9c53be104b13"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_a_log.html#ae110fbae5b42a1dd106a9c53be104b13">deleteOldLogs</a> ()</td></tr>
<tr class="memdesc:ae110fbae5b42a1dd106a9c53be104b13"><td class="mdescLeft">&#160;</td><td class="mdescRight">Cleans up old logs and initializes logging by preparing and installing a QMessageHandler.  <a href="namespace_a_log.html#ae110fbae5b42a1dd106a9c53be104b13">More...</a><br /></td></tr>
<tr class="separator:ae110fbae5b42a1dd106a9c53be104b13"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac797ea9883ac75b58c2b08a64bcc26d7"><td class="memItemLeft" align="right" valign="top"><a id="ac797ea9883ac75b58c2b08a64bcc26d7"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_a_log.html#ac797ea9883ac75b58c2b08a64bcc26d7">init</a> (bool log_debug)</td></tr>
<tr class="memdesc:ac797ea9883ac75b58c2b08a64bcc26d7"><td class="mdescLeft">&#160;</td><td class="mdescRight">initialise logging, clean up logfiles and install a QMessageHandler. To enable logging of debug messages, pass parameter as true. <br /></td></tr>
<tr class="separator:ac797ea9883ac75b58c2b08a64bcc26d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a421bd504f26d924e0557d6359d853f69"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespace_a_log.html#a421bd504f26d924e0557d6359d853f69">aMessageHandler</a> (QtMsgType type, const QMessageLogContext &amp;context, const QString &amp;msg)</td></tr>
<tr class="memdesc:a421bd504f26d924e0557d6359d853f69"><td class="mdescLeft">&#160;</td><td class="mdescRight">aMessageHandler Intercepts Messages and prints to console and log file  <a href="namespace_a_log.html#a421bd504f26d924e0557d6359d853f69">More...</a><br /></td></tr>
<tr class="separator:a421bd504f26d924e0557d6359d853f69"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The <a class="el" href="namespace_a_log.html" title="The ALog namespace encapsulates constants and functions used to provide logging to files and logging ...">ALog</a> namespace encapsulates constants and functions used to provide logging to files and logging to console (stdout) </p>
<p>The console output is color coded - green, amber, magenta for info, warn and crit messages, whereas the log files are just plain text.</p>
<p>There is a maximum of &lt;numberOfLogs&gt; log files with a maximum size of &lt;sizeOfLogs&gt;, at the moment, up to 10 logs of up to 100kB in size are kept, older logs are automatically deleted.</p>
<p>Debug output is not written to the logfile.</p>
<p>In order to start logging, the <a class="el" href="namespace_a_log.html#ac797ea9883ac75b58c2b08a64bcc26d7" title="initialise logging, clean up logfiles and install a QMessageHandler. To enable logging of debug messa...">ALog::init()</a> function has to be called</p>
<p>Credits to <a href="https://andydunkel.net/">Andy Dunkel</a> for his excellent blog post on Qt Log File Rotation! </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a421bd504f26d924e0557d6359d853f69"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a421bd504f26d924e0557d6359d853f69">&#9670;&nbsp;</a></span>aMessageHandler()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ALog::aMessageHandler </td>
          <td>(</td>
          <td class="paramtype">QtMsgType&#160;</td>
          <td class="paramname"><em>type</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QMessageLogContext &amp;&#160;</td>
          <td class="paramname"><em>context</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const QString &amp;&#160;</td>
          <td class="paramname"><em>msg</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>aMessageHandler Intercepts Messages and prints to console and log file </p>
<p>The message handler is responsible for intercepting the output from qDebug(), qInfo(), qWarning() and qCritical(), formatting them and printing them to the standard console out and to a logfile using QTextStream. Debug messages are not written to the log file. </p>

</div>
</div>
<a id="ae110fbae5b42a1dd106a9c53be104b13"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae110fbae5b42a1dd106a9c53be104b13">&#9670;&nbsp;</a></span>deleteOldLogs()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ALog::deleteOldLogs </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Cleans up old logs and initializes logging by preparing and installing a QMessageHandler. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespace_a_log.html">ALog</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.17 </li>
  </ul>
</div>
</body>
</html>