diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-04-02 06:24:05 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-04-02 06:24:05 +0000 |
commit | a6d8c8ff0c7d48e5e56728e3dc191ccb0a96418a (patch) | |
tree | 428cfc3b43089d16f2fb91699471d4a9949496d6 /sca-cpp/trunk/kernel/fstream.hpp | |
parent | 86b27d2bb7203724cf25cd134b2b4e1cefeacb42 (diff) |
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
Diffstat (limited to 'sca-cpp/trunk/kernel/fstream.hpp')
-rw-r--r-- | sca-cpp/trunk/kernel/fstream.hpp | 21 |
1 files changed, 7 insertions, 14 deletions
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<typename V> 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 |