]> git.ozlabs.org Git - petitboot/blobdiff - lib/log/log.c
lib/process: Add process_get_stdout
[petitboot] / lib / log / log.c
index adb207862b1c4a65286f6bb63aaf2b70ed76f99c..5466d817575277ab32f7a827f822cb36ccc08965 100644 (file)
@@ -34,6 +34,15 @@ void pb_log(const char *fmt, ...)
        va_end(ap);
 }
 
+void _pb_log_fn(const char *func, const char *fmt, ...)
+{
+       va_list ap;
+       pb_log("%s: ", func);
+       va_start(ap, fmt);
+       __log(fmt, ap);
+       va_end(ap);
+}
+
 void pb_debug(const char *fmt, ...)
 {
        va_list ap;
@@ -44,6 +53,28 @@ void pb_debug(const char *fmt, ...)
        va_end(ap);
 }
 
+void _pb_debug_fn(const char *func, const char *fmt, ...)
+{
+       va_list ap;
+       if (!debug)
+               return;
+       pb_log("%s: ", func);
+       va_start(ap, fmt);
+       __log(fmt, ap);
+       va_end(ap);
+}
+
+void _pb_debug_fl(const char *func, int line, const char *fmt, ...)
+{
+       va_list ap;
+       if (!debug)
+               return;
+       pb_log("%s:%d: ", func, line);
+       va_start(ap, fmt);
+       __log(fmt, ap);
+       va_end(ap);
+}
+
 void __pb_log_init(FILE *fp, bool _debug)
 {
        if (logf)
@@ -57,6 +88,11 @@ void pb_log_set_debug(bool _debug)
        debug = _debug;
 }
 
+bool pb_log_get_debug(void)
+{
+       return debug;
+}
+
 FILE *pb_log_get_stream(void)
 {
        static FILE *null_stream;