remove loglevel parameter from log_printf

Wed, 19 Jul 2023 20:47:10 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 19 Jul 2023 20:47:10 +0200
changeset 780
cd1c869720e0
parent 779
a0e02b70dad1
child 781
08d887af3971

remove loglevel parameter from log_printf

dav/sync.c file | annotate | diff | comparison | revisions
dav/sync.h file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Wed Jul 19 20:39:09 2023 +0200
+++ b/dav/sync.c	Wed Jul 19 20:47:10 2023 +0200
@@ -91,22 +91,18 @@
 };
 static size_t numdefprops = 8 ;
 
-void log_printf(const char *loglevel, const char *fmt, ...) {
-    const char *sp = " ";
-    if(!loglevel) {
-        loglevel = "";
-        sp = "";
-    }
-    
+void log_printf(const char *fmt, ...) {
     va_list ap;
     va_start(ap, fmt);
     cxmutstr str = cx_vasprintf(fmt, ap);
+    
+    printf("%s", str.ptr);
+    if(synclog) {
+        fprintf(synclog, "%s", str.ptr);
+    }
+    free(str.ptr);
+    
     va_end(ap);
-    
-    printf("%s\n", str.ptr);
-    if(synclog) {
-        fprintf(synclog, "%s%s%s\n", loglevel, sp, str.ptr);
-    }
 }
 
 /*
--- a/dav/sync.h	Wed Jul 19 20:39:09 2023 +0200
+++ b/dav/sync.h	Wed Jul 19 20:47:10 2023 +0200
@@ -105,7 +105,7 @@
 int cmd_push(CmdArgs *args, DavBool outgoing, DavBool archive);
 int cmd_restore(CmdArgs *args);
 
-void log_printf(const char *loglevel, const char *fmt, ...);
+void log_printf(const char *fmt, ...);
 
 void print_outgoing(
         CmdArgs *args,

mercurial