X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fverbose.c;h=3f971ce35e7ad6b60a046416d34253673336eaf1;hb=f83af86907f072b8d58bc84acfb431682a9e3080;hp=7e46a333a4b3d2d992d1eede9c4f5d408723c2fe;hpb=fb230eee946673ed5ebe9659d623c2a06d0a80ce;p=src%2Fapp-framework-binder.git diff --git a/src/verbose.c b/src/verbose.c index 7e46a333..3f971ce3 100644 --- a/src/verbose.c +++ b/src/verbose.c @@ -16,14 +16,31 @@ limitations under the License. */ +#include +#include + #include "verbose.h" -#if !defined(NDEBUG) int verbosity = 1; -#else -void verbose_error(const char *file, int line) + +static const char *prefixes[] = { + "<0> EMERGENCY", + "<1> ALERT", + "<2> CRITICAL", + "<3> ERROR", + "<4> WARNING", + "<5> NOTICE", + "<6> INFO", + "<7> DEBUG" +}; + +void verbose(int level, const char *file, int line, const char *fmt, ...) { - syslog(LOG_ERR, "error file %s line %d", file, line); -} -#endif + va_list ap; + fprintf(stderr, "%s: ", prefixes[level < 0 ? 0 : level > 7 ? 7 : level]); + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, " [%s:%d]\n", file, line); +}