X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fverbose.h;h=cf87ba07c31fe1b2709cbce607b692beb8f438f4;hb=c0fc18e47e49dd4e3cc2f09452a19297dad63f9c;hp=0a15564c001a5a3a0000ff4324904151c09bf30f;hpb=f3d64b7c741677cd28e2a11deed67196cd02b46a;p=src%2Fapp-framework-main.git diff --git a/src/verbose.h b/src/verbose.h index 0a15564..cf87ba0 100644 --- a/src/verbose.h +++ b/src/verbose.h @@ -1,6 +1,8 @@ /* Copyright 2015 IoT.bzh + author: José Bollo + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -14,11 +16,24 @@ limitations under the License. */ - +#if !defined(NDEBUG) +#include extern int verbosity; -#define warning(...) do{if(verbosity)syslog(LOG_WARNING,__VA_ARGS__);}while(0) -#define notice(...) do{if(verbosity)syslog(LOG_NOTICE,__VA_ARGS__);}while(0) -#define info(...) do{if(verbosity)syslog(LOG_INFO,__VA_ARGS__);}while(0) -#define debug(...) do{if(verbosity>1)syslog(LOG_DEBUG,__VA_ARGS__);}while(0) -extern int verbose_scan_args(int argc, char **argv); - +#define LOGUSER(app) openlog(app,LOG_PERROR,LOG_USER) +#define LOGAUTH(app) openlog(app,LOG_PERROR,LOG_AUTH) +#define ERROR(...) syslog(LOG_ERR,__VA_ARGS__) +#define WARNING(...) do{if(verbosity)syslog(LOG_WARNING,__VA_ARGS__);}while(0) +#define NOTICE(...) do{if(verbosity)syslog(LOG_NOTICE,__VA_ARGS__);}while(0) +#define INFO(...) do{if(verbosity)syslog(LOG_INFO,__VA_ARGS__);}while(0) +#define DEBUG(...) do{if(verbosity>1)syslog(LOG_DEBUG,__VA_ARGS__);}while(0) +#else +#include +#define LOGUSER(app) openlog(app,LOG_PERROR,LOG_USER) +#define LOGAUTH(app) openlog(app,LOG_PERROR,LOG_AUTH) +extern void verbose_error(const char *file, int line); +#define ERROR(...) verbose_error(__FILE__,__LINE__) +#define WARNING(...) do{/*nothing*/}while(0) +#define NOTICE(...) do{/*nothing*/}while(0) +#define INFO(...) do{/*nothing*/}while(0) +#define DEBUG(...) do{/*nothing*/}while(0) +#endif