Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
b5f5f391
Commit
b5f5f391
authored
5 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Nop out debug logging in release builds
parent
d6bc9fef
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llcommon/llerror.h
+44
-2
44 additions, 2 deletions
indra/llcommon/llerror.h
with
44 additions
and
2 deletions
indra/llcommon/llerror.h
+
44
−
2
View file @
b5f5f391
...
@@ -44,6 +44,7 @@ const int LL_ERR_NOERR = 0;
...
@@ -44,6 +44,7 @@ const int LL_ERR_NOERR = 0;
#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output.
#define RELEASE_SHOW_WARN // Define this if you want your release builds to show llwarn output.
#ifdef _DEBUG
#ifdef _DEBUG
#define ENABLE_DEBUG 1
#define SHOW_DEBUG
#define SHOW_DEBUG
#define SHOW_WARN
#define SHOW_WARN
#define SHOW_INFO
#define SHOW_INFO
...
@@ -51,10 +52,12 @@ const int LL_ERR_NOERR = 0;
...
@@ -51,10 +52,12 @@ const int LL_ERR_NOERR = 0;
#else // _DEBUG
#else // _DEBUG
#ifdef LL_RELEASE_WITH_DEBUG_INFO
#ifdef LL_RELEASE_WITH_DEBUG_INFO
#define ENABLE_DEBUG 1
#define SHOW_ASSERT
#define SHOW_ASSERT
#endif // LL_RELEASE_WITH_DEBUG_INFO
#endif // LL_RELEASE_WITH_DEBUG_INFO
#ifdef RELEASE_SHOW_DEBUG
#ifdef RELEASE_SHOW_DEBUG
#define ENABLE_DEBUG 1
#define SHOW_DEBUG
#define SHOW_DEBUG
#endif
#endif
...
@@ -289,6 +292,7 @@ namespace LLError
...
@@ -289,6 +292,7 @@ namespace LLError
}
}
//this is cheaper than llcallstacks if no need to output other variables to call stacks.
//this is cheaper than llcallstacks if no need to output other variables to call stacks.
#if ENABLE_DEBUG
#define LL_PUSH_CALLSTACKS() LLError::LLCallStacks::push(__FUNCTION__, __LINE__)
#define LL_PUSH_CALLSTACKS() LLError::LLCallStacks::push(__FUNCTION__, __LINE__)
#define llcallstacks \
#define llcallstacks \
...
@@ -300,6 +304,20 @@ namespace LLError
...
@@ -300,6 +304,20 @@ namespace LLError
LLError::End(); \
LLError::End(); \
LLError::LLCallStacks::end(_out) ; \
LLError::LLCallStacks::end(_out) ; \
}
}
#else
#define LL_PUSH_CALLSTACKS()
#define llcallstacks \
if (false) \
{ \
std::ostringstream* _out = LLError::LLCallStacks::insert(__FUNCTION__, __LINE__) ; \
(*_out)
#define llcallstacksendl \
LLError::End(); \
LLError::LLCallStacks::end(_out) ; \
}
#endif
#define LL_CLEAR_CALLSTACKS() LLError::LLCallStacks::clear()
#define LL_CLEAR_CALLSTACKS() LLError::LLCallStacks::clear()
#define LL_PRINT_CALLSTACKS() LLError::LLCallStacks::print()
#define LL_PRINT_CALLSTACKS() LLError::LLCallStacks::print()
...
@@ -346,6 +364,30 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
...
@@ -346,6 +364,30 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
std::ostringstream* _out = LLError::Log::out(); \
std::ostringstream* _out = LLError::Log::out(); \
(*_out)
(*_out)
#ifdef ENABLE_DEBUG
#define lllog_debug(level, once, ...) \
do { \
const char* tags[] = {"", ##__VA_ARGS__}; \
static LLError::CallSite _site(lllog_site_args_(level, once, tags)); \
lllog_test_debug_()
#define lllog_test_debug_() \
if (LL_UNLIKELY(_site.shouldLog())) \
{ \
std::ostringstream* _out = LLError::Log::out(); \
(*_out)
#else
#define lllog_debug(level, once, ...) \
do { \
if (false) \
{ \
const char* tags[] = {"", ##__VA_ARGS__}; \
LLError::CallSite _site(lllog_site_args_(level, once, tags)); \
std::ostringstream* _out = LLError::Log::out(); \
(*_out)
#endif
#define lllog_site_args_(level, once, tags) \
#define lllog_site_args_(level, once, tags) \
level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), \
level, __FILE__, __LINE__, typeid(_LL_CLASS_TO_LOG), \
__FUNCTION__, once, &tags[1], LL_ARRAY_SIZE(tags)-1
__FUNCTION__, once, &tags[1], LL_ARRAY_SIZE(tags)-1
...
@@ -376,7 +418,7 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
...
@@ -376,7 +418,7 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
// NEW Macros for debugging, allow the passing of a string tag
// NEW Macros for debugging, allow the passing of a string tag
// Pass comma separated list of tags (currently only supports up to 0, 1, or 2)
// Pass comma separated list of tags (currently only supports up to 0, 1, or 2)
#define LL_DEBUGS(...) lllog(LLError::LEVEL_DEBUG, false, ##__VA_ARGS__)
#define LL_DEBUGS(...) lllog
_debug
(LLError::LEVEL_DEBUG, false, ##__VA_ARGS__)
#define LL_INFOS(...) lllog(LLError::LEVEL_INFO, false, ##__VA_ARGS__)
#define LL_INFOS(...) lllog(LLError::LEVEL_INFO, false, ##__VA_ARGS__)
#define LL_WARNS(...) lllog(LLError::LEVEL_WARN, false, ##__VA_ARGS__)
#define LL_WARNS(...) lllog(LLError::LEVEL_WARN, false, ##__VA_ARGS__)
#define LL_ERRS(...) lllog(LLError::LEVEL_ERROR, false, ##__VA_ARGS__)
#define LL_ERRS(...) lllog(LLError::LEVEL_ERROR, false, ##__VA_ARGS__)
...
@@ -386,7 +428,7 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
...
@@ -386,7 +428,7 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
// Only print the log message once (good for warnings or infos that would otherwise
// 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).
// spam the log file over and over, such as tighter loops).
#define LL_DEBUGS_ONCE(...) lllog(LLError::LEVEL_DEBUG, true, ##__VA_ARGS__)
#define LL_DEBUGS_ONCE(...) lllog
_debug
(LLError::LEVEL_DEBUG, true, ##__VA_ARGS__)
#define LL_INFOS_ONCE(...) lllog(LLError::LEVEL_INFO, true, ##__VA_ARGS__)
#define LL_INFOS_ONCE(...) lllog(LLError::LEVEL_INFO, true, ##__VA_ARGS__)
#define LL_WARNS_ONCE(...) lllog(LLError::LEVEL_WARN, true, ##__VA_ARGS__)
#define LL_WARNS_ONCE(...) lllog(LLError::LEVEL_WARN, true, ##__VA_ARGS__)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment