This repository has been archived on 2022-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
speedclock/Arduino_Libs/Arduino-logging-library-master/doc/html/_logging_8cpp-source.html

146 lines
14 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Logging: K:/Projekte/robotic/arduino/arduino_1-0Patch/libraries/Logging/Logging.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<h1>K:/Projekte/robotic/arduino/arduino_1-0Patch/libraries/Logging/Logging.cpp</h1><a href="_logging_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "<a class="code" href="_logging_8h.html">Logging.h</a>"</span>
<a name="l00002"></a>00002
<a name="l00003"></a><a class="code" href="class_logging.html#f6a890a6feac5bf93b04cb22db7bd530">00003</a> <span class="keywordtype">void</span> <a class="code" href="class_logging.html#f6a890a6feac5bf93b04cb22db7bd530">Logging::Init</a>(<span class="keywordtype">int</span> level, <span class="keywordtype">long</span> baud){
<a name="l00004"></a>00004 <a class="code" href="class_logging.html#117105f639285ba5922836121294c04a">_level</a> = constrain(level,<a class="code" href="_logging_8h.html#33ec8ee51526c3b2008ed92830c1da16">LOG_LEVEL_NOOUTPUT</a>,<a class="code" href="_logging_8h.html#7d2f762be61df3727748e69e4ff197c2">LOG_LEVEL_VERBOSE</a>);
<a name="l00005"></a>00005 <a class="code" href="class_logging.html#8a2fe833b6e957b763146c32d6be5f2d">_baud</a> = baud;
<a name="l00006"></a>00006 Serial.begin(<a class="code" href="class_logging.html#8a2fe833b6e957b763146c32d6be5f2d">_baud</a>);
<a name="l00007"></a>00007 }
<a name="l00008"></a>00008
<a name="l00009"></a><a class="code" href="class_logging.html#1cf44ab531c72761fba811882336a2ad">00009</a> <span class="keywordtype">void</span> <a class="code" href="class_logging.html#1cf44ab531c72761fba811882336a2ad">Logging::Error</a>(<span class="keywordtype">char</span>* msg, ...){
<a name="l00010"></a>00010 <span class="keywordflow">if</span> (<a class="code" href="_logging_8h.html#ec8706c3ef9b186e438cccf4a02ccc78">LOG_LEVEL_ERRORS</a> &lt;= <a class="code" href="class_logging.html#117105f639285ba5922836121294c04a">_level</a>) {
<a name="l00011"></a>00011 <a class="code" href="class_logging.html#714840794950ab31df5da5b95322e391">print</a> (<span class="stringliteral">"ERROR: "</span>,0);
<a name="l00012"></a>00012 va_list args;
<a name="l00013"></a>00013 va_start(args, msg);
<a name="l00014"></a>00014 <a class="code" href="class_logging.html#714840794950ab31df5da5b95322e391">print</a>(msg,args);
<a name="l00015"></a>00015 }
<a name="l00016"></a>00016 }
<a name="l00017"></a>00017
<a name="l00018"></a>00018
<a name="l00019"></a><a class="code" href="class_logging.html#8a99e1a55e2b24d864d89e9aa86b2f2e">00019</a> <span class="keywordtype">void</span> <a class="code" href="class_logging.html#8a99e1a55e2b24d864d89e9aa86b2f2e">Logging::Info</a>(<span class="keywordtype">char</span>* msg, ...){
<a name="l00020"></a>00020 <span class="keywordflow">if</span> (<a class="code" href="_logging_8h.html#660a0bd19f239a2e586f9a432395289e">LOG_LEVEL_INFOS</a> &lt;= <a class="code" href="class_logging.html#117105f639285ba5922836121294c04a">_level</a>) {
<a name="l00021"></a>00021 va_list args;
<a name="l00022"></a>00022 va_start(args, msg);
<a name="l00023"></a>00023 <a class="code" href="class_logging.html#714840794950ab31df5da5b95322e391">print</a>(msg,args);
<a name="l00024"></a>00024 }
<a name="l00025"></a>00025 }
<a name="l00026"></a>00026
<a name="l00027"></a><a class="code" href="class_logging.html#e0fcd9e5350d7b9158c8ae9289fef193">00027</a> <span class="keywordtype">void</span> <a class="code" href="class_logging.html#e0fcd9e5350d7b9158c8ae9289fef193">Logging::Debug</a>(<span class="keywordtype">char</span>* msg, ...){
<a name="l00028"></a>00028 <span class="keywordflow">if</span> (<a class="code" href="_logging_8h.html#130224df8c6bf22a688e3cb74a45689a">LOG_LEVEL_DEBUG</a> &lt;= <a class="code" href="class_logging.html#117105f639285ba5922836121294c04a">_level</a>) {
<a name="l00029"></a>00029 va_list args;
<a name="l00030"></a>00030 va_start(args, msg);
<a name="l00031"></a>00031 <a class="code" href="class_logging.html#714840794950ab31df5da5b95322e391">print</a>(msg,args);
<a name="l00032"></a>00032 }
<a name="l00033"></a>00033 }
<a name="l00034"></a>00034
<a name="l00035"></a>00035
<a name="l00036"></a><a class="code" href="class_logging.html#2ae6a981ea685c851b87cf4c1ec2fb8f">00036</a> <span class="keywordtype">void</span> <a class="code" href="class_logging.html#2ae6a981ea685c851b87cf4c1ec2fb8f">Logging::Verbose</a>(<span class="keywordtype">char</span>* msg, ...){
<a name="l00037"></a>00037 <span class="keywordflow">if</span> (<a class="code" href="_logging_8h.html#7d2f762be61df3727748e69e4ff197c2">LOG_LEVEL_VERBOSE</a> &lt;= <a class="code" href="class_logging.html#117105f639285ba5922836121294c04a">_level</a>) {
<a name="l00038"></a>00038 va_list args;
<a name="l00039"></a>00039 va_start(args, msg);
<a name="l00040"></a>00040 <a class="code" href="class_logging.html#714840794950ab31df5da5b95322e391">print</a>(msg,args);
<a name="l00041"></a>00041 }
<a name="l00042"></a>00042 }
<a name="l00043"></a>00043
<a name="l00044"></a>00044
<a name="l00045"></a>00045
<a name="l00046"></a><a class="code" href="class_logging.html#714840794950ab31df5da5b95322e391">00046</a> <span class="keywordtype">void</span> <a class="code" href="class_logging.html#714840794950ab31df5da5b95322e391">Logging::print</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *format, va_list args) {
<a name="l00047"></a>00047 <span class="comment">//</span>
<a name="l00048"></a>00048 <span class="comment">// loop through format string</span>
<a name="l00049"></a>00049 <span class="keywordflow">for</span> (; *format != 0; ++format) {
<a name="l00050"></a>00050 <span class="keywordflow">if</span> (*format == <span class="charliteral">'%'</span>) {
<a name="l00051"></a>00051 ++format;
<a name="l00052"></a>00052 <span class="keywordflow">if</span> (*format == <span class="charliteral">'\0'</span>) <span class="keywordflow">break</span>;
<a name="l00053"></a>00053 <span class="keywordflow">if</span> (*format == <span class="charliteral">'%'</span>) {
<a name="l00054"></a>00054 Serial.print(*format);
<a name="l00055"></a>00055 <span class="keywordflow">continue</span>;
<a name="l00056"></a>00056 }
<a name="l00057"></a>00057 <span class="keywordflow">if</span>( *format == <span class="charliteral">'s'</span> ) {
<a name="l00058"></a>00058 <span class="keyword">register</span> <span class="keywordtype">char</span> *s = (<span class="keywordtype">char</span> *)va_arg( args, <span class="keywordtype">int</span> );
<a name="l00059"></a>00059 Serial.print(s);
<a name="l00060"></a>00060 <span class="keywordflow">continue</span>;
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 <span class="keywordflow">if</span>( *format == <span class="charliteral">'d'</span> || *format == <span class="charliteral">'i'</span>) {
<a name="l00063"></a>00063 Serial.print(va_arg( args, <span class="keywordtype">int</span> ),DEC);
<a name="l00064"></a>00064 <span class="keywordflow">continue</span>;
<a name="l00065"></a>00065 }
<a name="l00066"></a>00066 <span class="keywordflow">if</span>( *format == <span class="charliteral">'x'</span> ) {
<a name="l00067"></a>00067 Serial.print(va_arg( args, <span class="keywordtype">int</span> ),HEX);
<a name="l00068"></a>00068 <span class="keywordflow">continue</span>;
<a name="l00069"></a>00069 }
<a name="l00070"></a>00070 <span class="keywordflow">if</span>( *format == <span class="charliteral">'X'</span> ) {
<a name="l00071"></a>00071 Serial.print(<span class="stringliteral">"0x"</span>);
<a name="l00072"></a>00072 Serial.print(va_arg( args, <span class="keywordtype">int</span> ),HEX);
<a name="l00073"></a>00073 <span class="keywordflow">continue</span>;
<a name="l00074"></a>00074 }
<a name="l00075"></a>00075 <span class="keywordflow">if</span>( *format == <span class="charliteral">'b'</span> ) {
<a name="l00076"></a>00076 Serial.print(va_arg( args, <span class="keywordtype">int</span> ),BIN);
<a name="l00077"></a>00077 <span class="keywordflow">continue</span>;
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079 <span class="keywordflow">if</span>( *format == <span class="charliteral">'B'</span> ) {
<a name="l00080"></a>00080 Serial.print(<span class="stringliteral">"0b"</span>);
<a name="l00081"></a>00081 Serial.print(va_arg( args, <span class="keywordtype">int</span> ),BIN);
<a name="l00082"></a>00082 <span class="keywordflow">continue</span>;
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084 <span class="keywordflow">if</span>( *format == <span class="charliteral">'l'</span> ) {
<a name="l00085"></a>00085 Serial.print(va_arg( args, <span class="keywordtype">long</span> ),DEC);
<a name="l00086"></a>00086 <span class="keywordflow">continue</span>;
<a name="l00087"></a>00087 }
<a name="l00088"></a>00088
<a name="l00089"></a>00089 <span class="keywordflow">if</span>( *format == <span class="charliteral">'c'</span> ) {
<a name="l00090"></a>00090 Serial.print(va_arg( args, <span class="keywordtype">int</span> ));
<a name="l00091"></a>00091 <span class="keywordflow">continue</span>;
<a name="l00092"></a>00092 }
<a name="l00093"></a>00093 <span class="keywordflow">if</span>( *format == <span class="charliteral">'t'</span> ) {
<a name="l00094"></a>00094 <span class="keywordflow">if</span> (va_arg( args, <span class="keywordtype">int</span> ) == 1) {
<a name="l00095"></a>00095 Serial.print(<span class="stringliteral">"T"</span>);
<a name="l00096"></a>00096 }
<a name="l00097"></a>00097 <span class="keywordflow">else</span> {
<a name="l00098"></a>00098 Serial.print(<span class="stringliteral">"F"</span>);
<a name="l00099"></a>00099 }
<a name="l00100"></a>00100 <span class="keywordflow">continue</span>;
<a name="l00101"></a>00101 }
<a name="l00102"></a>00102 <span class="keywordflow">if</span>( *format == <span class="charliteral">'T'</span> ) {
<a name="l00103"></a>00103 <span class="keywordflow">if</span> (va_arg( args, <span class="keywordtype">int</span> ) == 1) {
<a name="l00104"></a>00104 Serial.print(<span class="stringliteral">"true"</span>);
<a name="l00105"></a>00105 }
<a name="l00106"></a>00106 <span class="keywordflow">else</span> {
<a name="l00107"></a>00107 Serial.print(<span class="stringliteral">"false"</span>);
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109 <span class="keywordflow">continue</span>;
<a name="l00110"></a>00110 }
<a name="l00111"></a>00111
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113 Serial.print(*format);
<a name="l00114"></a>00114 }
<a name="l00115"></a>00115 }
<a name="l00116"></a>00116
<a name="l00117"></a><a class="code" href="_logging_8h.html#f8164407f3289dde66d36070af4244c1">00117</a> <a class="code" href="class_logging.html">Logging</a> <a class="code" href="_logging_8cpp.html#f8164407f3289dde66d36070af4244c1">Log</a> = <a class="code" href="class_logging.html#cc3d848a3d05076fd185cd95e9c648d5">Logging</a>();
<a name="l00118"></a>00118
<a name="l00119"></a>00119
<a name="l00120"></a>00120
<a name="l00121"></a>00121
<a name="l00122"></a>00122
<a name="l00123"></a>00123
<a name="l00124"></a>00124
<a name="l00125"></a>00125
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Tue Mar 6 20:17:24 2012 for Logging by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
</body>
</html>