[master 3/6] log.c: factor out common parts from logMessageV()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 isys/log.c |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/isys/log.c b/isys/log.c
index 46d0931..2f921ba 100644
--- a/isys/log.c
+++ b/isys/log.c
@@ -95,6 +95,18 @@ static void printLogHeader(int level, FILE *outfile) {
     }
 }
 
+static void printLogMessage(int level, FILE *outfile, const char *s, va_list ap) {
+    printLogHeader(level, outfile);
+
+    va_list apc;
+    va_copy(apc, ap);
+    vfprintf(main_log_tty, s, apc);
+    va_end(apc);
+
+    fprintf(outfile, "\n");
+    fflush(outfile);
+}
+
 void logMessageV(int level, const char * s, va_list ap) {
     va_list apc;
     /* Log everything into syslog */
@@ -104,22 +116,12 @@ void logMessageV(int level, const char * s, va_list ap) {
 
     /* Only log to the screen things that are above the minimum level. */
     if (main_log_tty && level >= minLevel) {
-        printLogHeader(level, main_log_tty);
-        va_copy(apc, ap);
-        vfprintf(main_log_tty, s, apc);
-        va_end(apc);
-        fprintf(main_log_tty, "\n");
-        fflush(main_log_tty);
+        printLogMessage(level, main_log_tty, s, ap);
     }
 
     /* But log everything to the file. */
     if (main_log_file) {
-        printLogHeader(level, main_log_file);
-        va_copy(apc, ap);
-        vfprintf(main_log_file, s, apc);
-        va_end(apc);
-        fprintf(main_log_file, "\n");
-        fflush(main_log_file);
+        printLogMessage(level, main_log_file, s, ap);
     }
 }
 
-- 
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux