diff options
author | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-11-22 22:34:19 +0000 |
---|---|---|
committer | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-11-22 22:34:19 +0000 |
commit | 0a57b790871b27ea6fd3b1ba97474dddcce7845f (patch) | |
tree | 0ad46b248e42f96e93b54874aa3b073ad1273aa1 /navit/debug.h | |
parent | cffcb036be4aa6097d064c5fb55f3de1a84b23d0 (diff) | |
download | navit-svn-0a57b790871b27ea6fd3b1ba97474dddcce7845f.tar.gz |
Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5960 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/debug.h')
-rw-r--r-- | navit/debug.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/navit/debug.h b/navit/debug.h index 519e3e2e..a42de4a7 100644 --- a/navit/debug.h +++ b/navit/debug.h @@ -38,7 +38,21 @@ extern "C" { #endif #endif -extern int debug_level; +/** Possible debug levels (inspired by SLF4J). */ +typedef enum { + /** Internal use only, do not use for logging. */ + lvl_unset=-1, + /** Error: something did not work. */ + lvl_error, + /** Warning: something may not have worked. */ + lvl_warning, + /** Informational message. Should make sense to non-programmers. */ + lvl_info, + /** Debug output: (almost) anything goes. */ + lvl_debug +} dbg_level; + +extern dbg_level debug_level; #define dbg_str2(x) #x #define dbg_str1(x) dbg_str2(x) #define dbg_module dbg_str1(MODULE) @@ -70,11 +84,11 @@ extern int debug_level; struct attr; struct debug; void debug_init(const char *program_name); -void debug_level_set(const char *name, int level); +void debug_level_set(const char *name, dbg_level level); struct debug *debug_new(struct attr *parent, struct attr **attrs); -int debug_level_get(const char *name); -void debug_vprintf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap); -void debug_printf(int level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...) +dbg_level debug_level_get(const char *name); +void debug_vprintf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, va_list ap); +void debug_printf(dbg_level level, const char *module, const int mlen, const char *function, const int flen, int prefix, const char *fmt, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 7, 8))) #endif @@ -91,7 +105,7 @@ void debug_free(const char *where, int line, const char *func, void *ptr); void debug_free_func(void *ptr); void debug_finished(void); void *debug_realloc(const char *where, int line, const char *func, void *ptr, int size); -void debug_set_global_level(int level, int override_old_value); +void debug_set_global_level(dbg_level level, int override_old_value); /* end of prototypes */ #ifdef __cplusplus |