From a6d8c8ff0c7d48e5e56728e3dc191ccb0a96418a Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 2 Apr 2012 06:24:05 +0000 Subject: Add more fine grain debug options and remove overhead in debug log macros when logging is turned off. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1308248 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/kernel/fstream.hpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'sca-cpp/trunk/kernel/fstream.hpp') diff --git a/sca-cpp/trunk/kernel/fstream.hpp b/sca-cpp/trunk/kernel/fstream.hpp index fe95fc02e0..6afec8bd35 100644 --- a/sca-cpp/trunk/kernel/fstream.hpp +++ b/sca-cpp/trunk/kernel/fstream.hpp @@ -224,7 +224,7 @@ private: loghstream cinfo(APLOG_INFO); loghstream cfailure(APLOG_ERR); -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG /** * Debug log stream. @@ -234,9 +234,7 @@ loghstream cdebug(APLOG_DEBUG); /** * Return true if debug log is enabled. */ -const bool isDebugLog() { - return APLOG_MODULE_IS_LEVEL(ap_server_conf, APLOG_NO_MODULE, APLOG_DEBUG); -} +#define debug_islogging() (bool)(APLOG_MODULE_IS_LEVEL(ap_server_conf, APLOG_NO_MODULE, APLOG_DEBUG)) #endif @@ -321,7 +319,7 @@ private: logfstream cinfo(stderr, "info"); logfstream cfailure(stderr, "error"); -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG /** * Debug log stream. @@ -331,22 +329,18 @@ logfstream cdebug(stderr, "debug"); /** * Return true if debug log is enabled. */ -const bool isDebugLog() { - return true; -} +#define debug_islogging() true #endif #endif -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG /** * Log a debug message. */ const bool debugLog(const string& msg) { - if (!isDebugLog()) - return true; gc_scoped_pool(); cdebug << msg << endl; return true; @@ -356,17 +350,16 @@ const bool debugLog(const string& msg) { * Log a debug message and a value. */ template const bool debugLog(const V& v, const string& msg) { - if (!isDebugLog()) - return true; gc_scoped_pool(); cdebug << msg << ": " << v << endl; return true; } -#define debug(...) tuscany::debugLog(__VA_ARGS__) +#define debug(...) if (debug_islogging()) tuscany::debugLog(__VA_ARGS__) #else +#define debug_islogging() false #define debug(...) #endif -- cgit v1.2.3