[PATCH 1/6] added outputerr/outputstd log functions

Ildar Muslukhov <[email protected]>
Newsgroups org.kernel.vger.trinity
Message-ID <[email protected]>
Signed-off-by: Ildar Muslukhov <[email protected]>

---
 include/log.h |  2 ++
 log.c         | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/include/log.h b/include/log.h
index 2497988..7041eda 100644
--- a/include/log.h
+++ b/include/log.h
@@ -25,6 +25,8 @@
 unsigned int highest_logfile(void);
 void synclogs(void);
 void output(unsigned char level, const char *fmt, ...);
+void outputerr(const char *fmt, ...);
+void outputstd(const char *fmt, ...);
 void open_logfiles(void);
 void close_logfiles(void);
 
diff --git a/log.c b/log.c
index 850a3e2..144567a 100644
--- a/log.c
+++ b/log.c
@@ -221,3 +221,25 @@ void output(unsigned char level, const char *fmt, ...)
 	fprintf(handle, "%s %s", prefix, monobuf);
 	(void)fflush(handle);
 }
+
+/*
+* Used as a way to consolidated all printf calls if someones one to redirect it to somewhere else.
+* note: this function ignores quiet_level since it main purpose is error output.
+*/
+void outputerr(const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vfprintf(stderr, fmt, args);
+	va_end(args);
+}
+
+void outputstd(const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vfprintf(stdout, fmt, args);
+	va_end(args);
+}
-- 
1.8.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.