Skip to content

Commit 38a99c2

Browse files
authored
Added Trace loglevel
1 parent 3365e3e commit 38a99c2

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

ArduinoLog.h

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ Licensed under the MIT License <http://opensource.org/licenses/MIT>.
3535
#define LOG_LEVEL_ERROR 2
3636
#define LOG_LEVEL_WARNING 3
3737
#define LOG_LEVEL_NOTICE 4
38-
#define LOG_LEVEL_VERBOSE 5
38+
#define LOG_LEVEL_TRACE 5
39+
#define LOG_LEVEL_VERBOSE 6
3940

4041
#define CR "\n"
4142
#define LOGGING_VERSION 1_0_0
@@ -72,7 +73,8 @@ Licensed under the MIT License <http://opensource.org/licenses/MIT>.
7273
* 2 - LOG_LEVEL_ERROR all errors
7374
* 3 - LOG_LEVEL_WARNING errors, and warnings
7475
* 4 - LOG_LEVEL_NOTICE errors, warnings and notices
75-
* 5 - LOG_LEVEL_VERBOSE all
76+
* 5 - LOG_LEVEL_TRACE errors, warnings, notices, traces
77+
* 6 - LOG_LEVEL_VERBOSE all
7678
*/
7779

7880
class Logging {
@@ -180,6 +182,26 @@ class Logging {
180182
}
181183
#endif
182184
}
185+
/**
186+
* Output a trace message. Output message contains
187+
* Debug messages are printed out at l
188+
* loglevels >= LOG_LEVEL_VERBOSE
189+
*
190+
* \param msg format string to output
191+
* \param ... any number of variables
192+
* \return void
193+
*/
194+
template <class T> void trace(T msg, ...){
195+
#ifndef DISABLE_LOGGING
196+
if (LOG_LEVEL_TRACE <= _level) {
197+
if (_showLevel) _logOutput->print("T: ");
198+
va_list args;
199+
va_start(args, msg);
200+
print(msg,args);
201+
}
202+
#endif
203+
}
204+
183205
/**
184206
* Output an verbose message. Output message contains
185207
* Debug messages are printed out at l

0 commit comments

Comments
 (0)