diff options
| author | gkostka <kostka.grzegorz@gmail.com> | 2015-10-29 18:32:29 +0100 |
|---|---|---|
| committer | gkostka <kostka.grzegorz@gmail.com> | 2015-10-29 18:41:09 +0100 |
| commit | f0ec6ceeaa0f0d51a5f3d73d73f600fc87649acb (patch) | |
| tree | ff7b6af548f307b57783f7e5a680c4072fa71e6e | |
| parent | 190cc44e4cf4486c13ee43041167490f228fb110 (diff) | |
Refactor debug message format (CONFIG_DEBUG_PREFIX)
On some embedded devices debug printf length is limited to less
than 80 characters. It is good to have compile switch to control debug
prefix enable/disable.
| -rw-r--r-- | lwext4/ext4_config.h | 6 | ||||
| -rw-r--r-- | lwext4/ext4_debug.h | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/lwext4/ext4_config.h b/lwext4/ext4_config.h index 8a5f077..805c52a 100644 --- a/lwext4/ext4_config.h +++ b/lwext4/ext4_config.h @@ -94,6 +94,12 @@ #define CONFIG_DEBUG_PRINTF 1 #endif +/**@brief Debug printf prefixes*/ +#ifndef CONFIG_DEBUG_PREFIX +#define CONFIG_DEBUG_PREFIX 1 +#endif + + /**@brief Assert printf enable (stdout)*/ #ifndef CONFIG_DEBUG_ASSERT #define CONFIG_DEBUG_ASSERT 1 diff --git a/lwext4/ext4_debug.h b/lwext4/ext4_debug.h index fb8398d..271a9ae 100644 --- a/lwext4/ext4_debug.h +++ b/lwext4/ext4_debug.h @@ -135,13 +135,14 @@ uint32_t ext4_dmask_get(void); /**@brief Debug printf.*/ #define ext4_dbg(m, ...) \ do { \ - int __line = __LINE__; \ if (m & ext4_dmask_get()) { \ - printf(ext4_dmask_id2str(m)); \ - printf("line: %d ", __line); \ - printf(__VA_ARGS__); \ + if (CONFIG_DEBUG_PREFIX) { \ + printf(ext4_dmask_id2str(m)); \ + printf("l: %d ", __LINE__); \ + } \ + printf(__VA_ARGS__); \ fflush(stdout); \ - } \ + } \ } while (0) #else #define ext4_dbg(m, ...) do { } while (0) |
