X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fverbose.c;h=29d2a9e647c23a179f0cb190046bfd655feb011c;hb=7ea1657b459aea2cc6ef9332621a19d7e2676b1d;hp=3175cecb4b142f2412d085f3cf4fb680db606755;hpb=f1b901ed676b2d45ec8e6ae3d6ef2f94d79f9ee6;p=src%2Fapp-framework-binder.git diff --git a/src/verbose.c b/src/verbose.c index 3175cecb..29d2a9e6 100644 --- a/src/verbose.c +++ b/src/verbose.c @@ -16,7 +16,30 @@ 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); +}