[Pkg-voip-commits] [bctoolbox] 16/60: Offer the choice to create a defaut logger or not a initialization

Bernhard Schmidt berni at moszumanska.debian.org
Sun Oct 15 22:42:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

berni pushed a commit to branch debian/sid
in repository bctoolbox.

commit f89b7c23bb01c66e2c04498ff8d9caa6ea0c2655
Author: Benjamin Reis <benjamin.reis at belledonne-communications.com>
Date:   Tue Apr 4 11:00:28 2017 +0200

    Offer the choice to create a defaut logger or not a initialization
---
 include/bctoolbox/logging.h | 4 +++-
 src/logging/logging.c       | 9 +++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/include/bctoolbox/logging.h b/include/bctoolbox/logging.h
index dcf8380..5fb39bb 100644
--- a/include/bctoolbox/logging.h
+++ b/include/bctoolbox/logging.h
@@ -57,7 +57,9 @@ typedef void (*BctoolboxLogHandlerDestroyFunc)(BctoolboxLogHandler* handler);
 /*
  initialise logging functions, add default log handler for stdout output.
  */
-BCTBX_PUBLIC void bctbx_init_logger(void);
+BCTBX_PUBLIC void bctbx_init_logger(bool_t create);
+#define bctbx_init_logger() bctbx_init_logger(TRUE);
+
 /*
  free logging memory
  */
diff --git a/src/logging/logging.c b/src/logging/logging.c
index 6de30e8..5399deb 100644
--- a/src/logging/logging.c
+++ b/src/logging/logging.c
@@ -66,13 +66,14 @@ typedef struct _BctoolboxFileLogHandler{
 static BctoolboxLogger __bctbx_logger = { NULL, BCTBX_LOG_WARNING|BCTBX_LOG_ERROR|BCTBX_LOG_FATAL, 0};
 
 static unsigned int bctbx_init_logger_refcount = 0;
-void bctbx_init_logger(void){
-	BctoolboxLogHandler* handler;
+void bctbx_init_logger(bool_t create){
 	if (bctbx_init_logger_refcount++ > 0) return; /*already initialized*/
 	
 	bctbx_mutex_init(&__bctbx_logger.domains_mutex, NULL);
-	handler = bctbx_create_log_handler(bctbx_logv_out, bctbx_logv_out_destroy, NULL);
-	bctbx_add_log_handler(handler);
+	if(create) {
+		BctoolboxLogHandler* handler = bctbx_create_log_handler(bctbx_logv_out, bctbx_logv_out_destroy, NULL);
+		bctbx_add_log_handler(handler);
+	}
 }
 
 void bctbx_log_handlers_free(void) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/bctoolbox.git



More information about the Pkg-voip-commits mailing list