X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fverbose.c;h=3f971ce35e7ad6b60a046416d34253673336eaf1;hb=f83af86907f072b8d58bc84acfb431682a9e3080;hp=3175cecb4b142f2412d085f3cf4fb680db606755;hpb=82adb27966eace72f810716c19c660efd7c8b15a;p=src%2Fapp-framework-binder.git diff --git a/src/verbose.c b/src/verbose.c index 3175cecb..3f971ce3 100644 --- a/src/verbose.c +++ b/src/verbose.c @@ -16,7 +16,31 @@ limitations under the License. */ +#include +#include + #include "verbose.h" int verbosity = 1; +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, ...) +{ + 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); +}