Skip to content

Commit

Permalink
puts LoggerLevel strings also in program memory
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Schulze committed Jun 30, 2010
1 parent 35ea52d commit 11c1379
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
28 changes: 15 additions & 13 deletions include/logging/LoggerLevel.h
Expand Up @@ -40,6 +40,8 @@
#ifndef __LoggerLevel_h__
#define __LoggerLevel_h__

#include "logging/ProgramMemoryString.h"

/*! \brief The macro genrate %logging levels
*
* \param LEVELNAME is the typename of the generated level.
Expand All @@ -62,8 +64,8 @@ struct LEVELNAME { \
return LEVEL; \
} \
/*! \brief delivers the string reporting the current %level of %logging */\
static const char * desc() { \
return DESC; \
static PROGMEMSTRINGTYPE desc() { \
return PROGMEMSTRING(DESC); \
} \
}

Expand Down Expand Up @@ -114,8 +116,8 @@ namespace logging {
return ::logging::Level::error;
}
/*! \brief delivers the string reporting the current %level of %logging */
static const char * desc() {
return "[ ERROR ] ";
static PROGMEMSTRINGTYPE desc() {
return PROGMEMSTRING("[ ERROR ] ");
}
};

Expand All @@ -131,8 +133,8 @@ namespace logging {
return ::logging::Level::warning;
}
/*! \brief delivers the string reporting the current %level of %logging */
static const char * desc() {
return "[Warning] ";
static PROGMEMSTRINGTYPE desc() {
return PROGMEMSTRING("[Warning] ");
}
};

Expand All @@ -148,7 +150,7 @@ namespace logging {
return ::logging::Level::normal;
}
/*! \brief delivers the string reporting the current %level of %logging */
static const char * desc() {
static const char* desc() {
return 0;
}
};
Expand All @@ -168,8 +170,8 @@ namespace logging {
return ::logging::Level::info;
}
/*! \brief delivers the string reporting the current %level of %logging */
static const char * desc() {
return "[ INFO ] ";
static PROGMEMSTRINGTYPE desc() {
return PROGMEMSTRING("[ INFO ] ");
}
};

Expand All @@ -185,8 +187,8 @@ namespace logging {
return ::logging::Level::trace;
}
/*! \brief delivers the string reporting the current %level of %logging */
static const char * desc() {
return "[ TRACE ] ";
static PROGMEMSTRINGTYPE desc() {
return PROGMEMSTRING("[ TRACE ] ");
}
};

Expand All @@ -202,8 +204,8 @@ namespace logging {
return ::logging::Level::debug;
}
/*! \brief delivers the string reporting the current %level of %logging */
static const char * desc() {
return "[ DEBUG ] ";
static PROGMEMSTRINGTYPE desc() {
return PROGMEMSTRING("[ DEBUG ] ");
}
};

Expand Down
3 changes: 0 additions & 3 deletions include/logging/ProgramMemoryStringImpl.h
Expand Up @@ -46,9 +46,6 @@

#else /* !__AVR__ */

#undef PROGMEMSTRING
#define PROGMEMSTRING(S) S

static inline char pgm_read_byte_far(const char* t) {
return *t;
}
Expand Down

0 comments on commit 11c1379

Please sign in to comment.