diff options
author | nat-goodspeed <nat@lindenlab.com> | 2023-05-04 13:39:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 13:39:59 -0400 |
commit | 66413dfa383b5f74bce7be498eb8f1dd3ce54db7 (patch) | |
tree | dca9be58e43a6c09664e05cc55771e9769832e92 /indra/llcommon/llerror.h | |
parent | a9dca4577337037f1b4a62713927871666014043 (diff) | |
parent | e3f3eea825f9812afe2e79c0669170173be68793 (diff) |
Merge pull request #203 from secondlife/DRTVWR-559-zapfunc
DRTVWR-559: Replace debugLoggingEnabled() function with LL_DEBUGS().
Diffstat (limited to 'indra/llcommon/llerror.h')
-rw-r--r-- | indra/llcommon/llerror.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h index b7dec3cb7f..08eb323c4a 100644 --- a/indra/llcommon/llerror.h +++ b/indra/llcommon/llerror.h @@ -467,7 +467,29 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG; LLError::CallSite& _site(_sites[which]); \ lllog_test_() -// Check at run-time whether logging is enabled, without generating output +/* +// Check at run-time whether logging is enabled, without generating output. +Resist the temptation to add a function like this because it incurs the +expense of locking and map-searching every time control reaches it. bool debugLoggingEnabled(const std::string& tag); +Instead of: + +if debugLoggingEnabled("SomeTag") +{ + // ... presumably expensive operation ... + LL_DEBUGS("SomeTag") << ... << LL_ENDL; +} + +Use this: + +LL_DEBUGS("SomeTag"); +// ... presumably expensive operation ... +LL_CONT << ...; +LL_ENDL; + +LL_DEBUGS("SomeTag") performs the locking and map-searching ONCE, then caches +the result in a static variable. +*/ + #endif // LL_LLERROR_H |