Skip to content

Commit 977dd81

Browse files
committed
remove pre processing directives
1 parent c52ce5a commit 977dd81

File tree

4 files changed

+36
-28
lines changed

4 files changed

+36
-28
lines changed

Diff for: Logging.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void Logging::Error(char* msg, ...){
1919
}
2020
}
2121

22-
#if LOGLEVEL >= LOG_LEVEL_INFOS
22+
2323
void Logging::Info(char* msg, ...){
2424
if (LOG_LEVEL_INFOS <= _level) {
2525
va_list args;
@@ -28,7 +28,6 @@ void Logging::Info(char* msg, ...){
2828
}
2929
}
3030

31-
#if LOGLEVEL >= LOG_LEVEL_DEBUG
3231
void Logging::Debug(char* msg, ...){
3332
if (LOG_LEVEL_DEBUG <= _level) {
3433
va_list args;
@@ -37,17 +36,15 @@ void Logging::Debug(char* msg, ...){
3736
}
3837
}
3938

40-
#if LOGLEVEL >= LOG_LEVEL_VERBOSE
39+
4140
void Logging::Verbose(char* msg, ...){
4241
if (LOG_LEVEL_VERBOSE <= _level) {
4342
va_list args;
4443
va_start(args, msg);
4544
print(msg,args);
4645
}
4746
}
48-
#endif // LOG_LEVEL_VERBOSE
49-
#endif // LOG_LEVEL_DEBUG
50-
#endif // LOG_LEVEL_INFOS
47+
5148

5249

5350
void Logging::print(const char *format, va_list args) {

Diff for: Logging.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ class Logging {
105105
* \param ... any number of variables
106106
* \return void
107107
*/
108-
#if LOGLEVEL >= LOG_LEVEL_INFOS
108+
109109
void Info(char* msg, ...);
110110

111111
/**
@@ -117,7 +117,7 @@ class Logging {
117117
* \param ... any number of variables
118118
* \return void
119119
*/
120-
#if LOGLEVEL >= LOG_LEVEL_DEBUG
120+
121121
void Debug(char* msg, ...);
122122

123123
/**
@@ -129,11 +129,9 @@ class Logging {
129129
* \param ... any number of variables
130130
* \return void
131131
*/
132-
#if LOGLEVEL >= LOG_LEVEL_VERBOSE
132+
133133
void Verbose(char* msg, ...);
134-
#endif // LOG_LEVEL_VERBOSE
135-
#endif // LOG_LEVEL_DEBUG
136-
#endif // LOG_LEVEL_INFOS
134+
137135

138136
private:
139137
void print(const char *format, va_list args);

Diff for: Logging.zip

-65 Bytes
Binary file not shown.

Diff for: Logging_WikiPage.txt

+29-16
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,47 @@ by LunaX - 2010/2011
88

99
!CURRENT VERSION
1010

11-
0.8)14-FEB-2012 beta version.
11+
1.0)24-FEB-2012 beta version.
1212

1313
!HISTORY
1414

15-
0.8) 14-FEB-2012 Initial Release\\
15+
1.0) 24-FEB-2012 Initial Release\\
1616

1717

1818
!DESCRIPTION
1919
Easy to use logging library, like log4j or log4net. After getting a logger object, you will have
2020
methods like Error, Info, Warn, Debug, Verbose to log informations over RS232.
2121
Depending on the current loglevel lower logleves are not printed out.
2222
It is possible to work with variable argument lists during output.
23+
Detailed description is included in doc folder
2324

2425
!HOW TO IMPORT/INSTALL
25-
Download here: [[Attach:Enerlib.zip|Enerlib 1.0.0]]
26+
Download here zip file here [[https://github.com/mrRobot62/Arduino-logging-library]]
2627

2728
Put the Logging folder in "libraries\".
2829

29-
In the Arduino IDE, create a new sketch (or open one) and select from the menubar "Sketch->Import Library->Logging".
30-
Once the library is imported, a "#include <Logging.h>" line will appear at the top of your Sketch.
31-
32-
!Methods
33-
!!void Error(
34-
35-
!Loglevels
36-
37-
!Example
38-
For more examples look into sub folder examples
39-
40-
41-
@]%%
30+
Open example project which is included in the zip file. Try it, like it :-)
31+
32+
Some benefits:
33+
!Use formated strings with wildcards
34+
||border=0
35+
||!wildcard ||!Comment ||Example ||
36+
||%s ||replace with an string (char*) ||logger.Info("String %s",myString); ||
37+
||%c ||replace with an character ||logger.Info("use %c as input",myChar); ||
38+
||%d ||replace with an integer value ||logger.Info("current value %d",myValue); ||
39+
||%l ||replace with an long value ||logger.Info("current long %l",myLong); ||
40+
||%x ||replace and convert integer value into hex ||logger.Info ("as hex %x), myValue); ||
41+
||%X ||like %x but combine with 0x123AB ||logger.Info ("as hex %X), myValue); ||
42+
||%b ||replace and convert integer value into binary ||logger.Info ("as bin %b), myValue); ||
43+
||%B ||like %x but combine with 0b10100011 ||logger.Info ("as bin %B), myValue); ||
44+
||%t ||replace and convert boolean value into "t" or "f" ||logger.Info ("is it true? %t), myBool); ||
45+
||%T ||like %t but convert into "true" or "false" ||logger.Info ("is it true? %T), myBool); ||
46+
47+
!Methods for output
48+
||border=0
49+
||!Methode ||!Comment ||
50+
||Error ||print messages with loglevel >= LOGLEVEL_ERROR ||
51+
||Info ||print messages with loglevel >= LOGLEVEL_INFO ||
52+
||Debug ||print messages with loglevel >= LOGLEVEL_DEBUG ||
53+
||Verbose ||print messages with loglevel >= LOGLEVEL_VERGBOSE ||
54+
%%

0 commit comments

Comments
 (0)