Add possibility to suppress function name prefix in debug output.
Adds llinfos_nf et al.
This commit is contained in:
@@ -963,10 +963,14 @@ namespace LLError
|
||||
settings_w->shouldLogCallCounter += 1;
|
||||
|
||||
std::string class_name = className(site.mClassInfo);
|
||||
std::string function_name = functionName(site.mFunction);
|
||||
if (site.mClassInfo != typeid(NoClassInfo))
|
||||
std::string function_name;
|
||||
if (site.mFunction)
|
||||
{
|
||||
function_name = class_name + "::" + function_name;
|
||||
function_name = functionName(site.mFunction);
|
||||
if (site.mClassInfo != typeid(NoClassInfo))
|
||||
{
|
||||
function_name = class_name + "::" + function_name;
|
||||
}
|
||||
}
|
||||
|
||||
ELevel compareLevel = settings_w->defaultLevel;
|
||||
@@ -976,7 +980,7 @@ namespace LLError
|
||||
// So, in increasing order of importance:
|
||||
// Default < Broad Tag < File < Class < Function < Narrow Tag
|
||||
((site.mNarrowTag != NULL) ? checkLevelMap(settings_w->tagLevelMap, site.mNarrowTag, compareLevel) : false)
|
||||
|| checkLevelMap(settings_w->functionLevelMap, function_name, compareLevel)
|
||||
|| (site.mFunction && checkLevelMap(settings_w->functionLevelMap, function_name, compareLevel))
|
||||
|| checkLevelMap(settings_w->classLevelMap, class_name, compareLevel)
|
||||
|| checkLevelMap(settings_w->fileLevelMap, abbreviateFile(site.mFile), compareLevel)
|
||||
|| ((site.mBroadTag != NULL) ? checkLevelMap(settings_w->tagLevelMap, site.mBroadTag, compareLevel) : false);
|
||||
@@ -1083,8 +1087,8 @@ namespace LLError
|
||||
default: prefix << "XXX"; break;
|
||||
};
|
||||
|
||||
bool need_function = true;
|
||||
if (site.mBroadTag && *site.mBroadTag != '\0')
|
||||
bool need_function = site.mFunction;
|
||||
if (need_function && site.mBroadTag && *site.mBroadTag != '\0')
|
||||
{
|
||||
prefix << "(\"" << site.mBroadTag << "\")";
|
||||
#if LL_DEBUG
|
||||
@@ -1112,7 +1116,7 @@ namespace LLError
|
||||
#if LL_WINDOWS
|
||||
// DevStudio: __FUNCTION__ already includes the full class name
|
||||
#else
|
||||
if (need_function && site.mClassInfo != typeid(NoClassInfo))
|
||||
if (site.mClassInfo != typeid(NoClassInfo))
|
||||
{
|
||||
prefix << className(site.mClassInfo) << "::";
|
||||
}
|
||||
|
||||
@@ -238,10 +238,10 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
|
||||
See top of file for common usage.
|
||||
*/
|
||||
|
||||
#define lllog(level, broadTag, narrowTag, once) \
|
||||
#define lllog(level, broadTag, narrowTag, once, nofunction) \
|
||||
do { \
|
||||
static LLError::CallSite _site( \
|
||||
level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), __FUNCTION__, broadTag, narrowTag, once);\
|
||||
level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), nofunction ? NULL : __FUNCTION__, broadTag, narrowTag, once);\
|
||||
if (LL_UNLIKELY(_site.shouldLog())) \
|
||||
{ \
|
||||
std::ostringstream* _out = LLError::Log::out(); \
|
||||
@@ -255,33 +255,39 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
|
||||
} while(0)
|
||||
|
||||
// DEPRECATED: Use the new macros that allow tags and *look* like macros.
|
||||
#define lldebugs lllog(LLError::LEVEL_DEBUG, NULL, NULL, false)
|
||||
#define llinfos lllog(LLError::LEVEL_INFO, NULL, NULL, false)
|
||||
#define llwarns lllog(LLError::LEVEL_WARN, NULL, NULL, false)
|
||||
#define llerrs lllog(LLError::LEVEL_ERROR, NULL, NULL, false)
|
||||
#define lldebugs lllog(LLError::LEVEL_DEBUG, NULL, NULL, false, false)
|
||||
#define llinfos lllog(LLError::LEVEL_INFO, NULL, NULL, false, false)
|
||||
#define llwarns lllog(LLError::LEVEL_WARN, NULL, NULL, false, false)
|
||||
#define llerrs lllog(LLError::LEVEL_ERROR, NULL, NULL, false, false)
|
||||
#define llcont (*_out)
|
||||
|
||||
// No function name
|
||||
#define lldebugs_nf lllog(LLError::LEVEL_DEBUG, NULL, NULL, false, true)
|
||||
#define llinfos_nf lllog(LLError::LEVEL_INFO, NULL, NULL, false, true)
|
||||
#define llwarns_nf lllog(LLError::LEVEL_WARN, NULL, NULL, false, true)
|
||||
#define llerrs_nf lllog(LLError::LEVEL_ERROR, NULL, NULL, false, true)
|
||||
|
||||
// NEW Macros for debugging, allow the passing of a string tag
|
||||
|
||||
// One Tag
|
||||
#define LL_DEBUGS(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, false)
|
||||
#define LL_INFOS(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, false)
|
||||
#define LL_WARNS(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, false)
|
||||
#define LL_ERRS(broadTag) lllog(LLError::LEVEL_ERROR, broadTag, NULL, false)
|
||||
#define LL_DEBUGS(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, false, false)
|
||||
#define LL_INFOS(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, false, false)
|
||||
#define LL_WARNS(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, false, false)
|
||||
#define LL_ERRS(broadTag) lllog(LLError::LEVEL_ERROR, broadTag, NULL, false, false)
|
||||
// Two Tags
|
||||
#define LL_DEBUGS2(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, false)
|
||||
#define LL_INFOS2(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, false)
|
||||
#define LL_WARNS2(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, false)
|
||||
#define LL_ERRS2(broadTag, narrowTag) lllog(LLError::LEVEL_ERROR, broadTag, narrowTag, false)
|
||||
#define LL_DEBUGS2(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, false, false)
|
||||
#define LL_INFOS2(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, false, false)
|
||||
#define LL_WARNS2(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, false, false)
|
||||
#define LL_ERRS2(broadTag, narrowTag) lllog(LLError::LEVEL_ERROR, broadTag, narrowTag, false, false)
|
||||
|
||||
// Only print the log message once (good for warnings or infos that would otherwise
|
||||
// spam the log file over and over, such as tighter loops).
|
||||
#define LL_DEBUGS_ONCE(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, true)
|
||||
#define LL_INFOS_ONCE(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, true)
|
||||
#define LL_WARNS_ONCE(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, true)
|
||||
#define LL_DEBUGS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, true)
|
||||
#define LL_INFOS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, true)
|
||||
#define LL_WARNS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, true)
|
||||
#define LL_DEBUGS_ONCE(broadTag) lllog(LLError::LEVEL_DEBUG, broadTag, NULL, true, false)
|
||||
#define LL_INFOS_ONCE(broadTag) lllog(LLError::LEVEL_INFO, broadTag, NULL, true, false)
|
||||
#define LL_WARNS_ONCE(broadTag) lllog(LLError::LEVEL_WARN, broadTag, NULL, true, false)
|
||||
#define LL_DEBUGS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_DEBUG, broadTag, narrowTag, true, false)
|
||||
#define LL_INFOS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_INFO, broadTag, narrowTag, true, false)
|
||||
#define LL_WARNS2_ONCE(broadTag, narrowTag) lllog(LLError::LEVEL_WARN, broadTag, narrowTag, true, false)
|
||||
|
||||
#define LL_ENDL llendl
|
||||
#define LL_CONT (*_out)
|
||||
|
||||
@@ -547,12 +547,12 @@ LLAtomicU32 Stats::multi_errors;
|
||||
//static
|
||||
void Stats::print(void)
|
||||
{
|
||||
llinfos << "============ CURL STATS ============" << llendl;
|
||||
llinfos << " Curl multi errors/calls : " << std::dec << multi_errors << "/" << multi_calls << llendl;
|
||||
llinfos << " Curl easy errors/calls : " << std::dec << easy_errors << "/" << easy_calls << llendl;
|
||||
llinfos << " curl_easy_init() errors/calls : " << std::dec << easy_init_errors << "/" << easy_init_calls << llendl;
|
||||
llinfos << " Current number of curl easy handles: " << std::dec << (easy_init_calls - easy_init_errors - easy_cleanup_calls) << llendl;
|
||||
llinfos << "========= END OF CURL STATS =========" << llendl;
|
||||
llinfos_nf << "============ CURL STATS ============" << llendl;
|
||||
llinfos_nf << " Curl multi errors/calls : " << std::dec << multi_errors << "/" << multi_calls << llendl;
|
||||
llinfos_nf << " Curl easy errors/calls : " << std::dec << easy_errors << "/" << easy_calls << llendl;
|
||||
llinfos_nf << " curl_easy_init() errors/calls : " << std::dec << easy_init_errors << "/" << easy_init_calls << llendl;
|
||||
llinfos_nf << " Current number of curl easy handles: " << std::dec << (easy_init_calls - easy_init_errors - easy_cleanup_calls) << llendl;
|
||||
llinfos_nf << "========= END OF CURL STATS =========" << llendl;
|
||||
}
|
||||
|
||||
// THREAD-SAFE
|
||||
@@ -806,7 +806,7 @@ void CurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void* us
|
||||
setopt(CURLOPT_SSL_CTX_DATA, userdata ? this : NULL);
|
||||
}
|
||||
|
||||
#define llmaybewarns lllog(LLApp::isExiting() ? LLError::LEVEL_INFO : LLError::LEVEL_WARN, NULL, NULL, false)
|
||||
#define llmaybewarns lllog(LLApp::isExiting() ? LLError::LEVEL_INFO : LLError::LEVEL_WARN, NULL, NULL, false, true)
|
||||
|
||||
static size_t noHeaderCallback(char* ptr, size_t size, size_t nmemb, void* userdata)
|
||||
{
|
||||
@@ -1127,7 +1127,7 @@ CurlResponderBuffer::CurlResponderBuffer()
|
||||
curl_easy_request_w->send_events_to(this);
|
||||
}
|
||||
|
||||
#define llmaybeerrs lllog(LLApp::isRunning() ? LLError::LEVEL_ERROR : LLError::LEVEL_WARN, NULL, NULL, false)
|
||||
#define llmaybeerrs lllog(LLApp::isRunning() ? LLError::LEVEL_ERROR : LLError::LEVEL_WARN, NULL, NULL, false, true)
|
||||
|
||||
// The callbacks need to be revoked when the CurlResponderBuffer is destructed (because that is what the callbacks use).
|
||||
// The AIThreadSafeSimple<CurlResponderBuffer> is destructed first (right to left), so when we get here then the
|
||||
|
||||
Reference in New Issue
Block a user