diff options
author | José Bollo <jose.bollo@iot.bzh> | 2017-04-07 12:52:58 +0200 |
---|---|---|
committer | José Bollo <jose.bollo@iot.bzh> | 2017-04-07 12:52:58 +0200 |
commit | 59db7c73c9d98414be9edf7056d7afe025512b3e (patch) | |
tree | 17d0fc469b8a0b18a4eaea414990c66702789114 /src/verbose.h | |
parent | 4846cec0be7f41f992b9f89b7adb97033e15b1a0 (diff) |
Improve log messages
Add ability to discuss directly with systemd journal.
Add report of functions name when logging.
Change-Id: Ia7c5836e387b621b47e3700a7abca40bc0e481c8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/verbose.h')
-rw-r--r-- | src/verbose.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/verbose.h b/src/verbose.h index 7e4d84f7..71d5fe1e 100644 --- a/src/verbose.h +++ b/src/verbose.h @@ -23,14 +23,14 @@ extern int verbosity; extern void verbose_set_name(const char *name, int authority); -extern void verbose(int level, const char *file, int line, const char *fmt, ...) __attribute__((format(printf, 4, 5))); -extern void vverbose(int level, const char *file, int line, const char *fmt, va_list args); - -# define ERROR(...) do{if(verbosity>=0)verbose(3,__FILE__,__LINE__,__VA_ARGS__);}while(0) -# define WARNING(...) do{if(verbosity>=1)verbose(4,__FILE__,__LINE__,__VA_ARGS__);}while(0) -# define NOTICE(...) do{if(verbosity>=1)verbose(5,__FILE__,__LINE__,__VA_ARGS__);}while(0) -# define INFO(...) do{if(verbosity>=2)verbose(6,__FILE__,__LINE__,__VA_ARGS__);}while(0) -# define DEBUG(...) do{if(verbosity>=3)verbose(7,__FILE__,__LINE__,__VA_ARGS__);}while(0) +extern void verbose(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf, 5, 6))); +extern void vverbose(int level, const char *file, int line, const char *function, const char *fmt, va_list args); + +# define ERROR(...) do{if(verbosity>=0)verbose(3,__FILE__,__LINE__,__func__,__VA_ARGS__);}while(0) +# define WARNING(...) do{if(verbosity>=1)verbose(4,__FILE__,__LINE__,__func__,__VA_ARGS__);}while(0) +# define NOTICE(...) do{if(verbosity>=1)verbose(5,__FILE__,__LINE__,__func__,__VA_ARGS__);}while(0) +# define INFO(...) do{if(verbosity>=2)verbose(6,__FILE__,__LINE__,__func__,__VA_ARGS__);}while(0) +# define DEBUG(...) do{if(verbosity>=3)verbose(7,__FILE__,__LINE__,__func__,__VA_ARGS__);}while(0) # define LOGUSER(app) verbose_set_name(app,0) # define LOGAUTH(app) verbose_set_name(app,1) |