Commit 4bc07ade by Ben Clayton

Debug: Control logging level using a compile time knob

`SWIFTSHADER_LOGGING_LEVEL` controls how much logging we perform. It defaults to `INFO`, so logs at `DEBUG` level are not printed by default. Bug: b/146051794 Change-Id: I2037d1c912b24ee8d2e6543074850b65bbbd988a Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40975Reviewed-by: 's avatarAntonio Maiorano <amaiorano@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent a8e4ecdd
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
# undef ERROR // b/127920555 # undef ERROR // b/127920555
#endif #endif
#ifndef SWIFTSHADER_LOGGING_LEVEL
# define SWIFTSHADER_LOGGING_LEVEL INFO
#endif
namespace { namespace {
bool IsUnderDebugger() bool IsUnderDebugger()
...@@ -143,6 +147,11 @@ void logv_std(Level level, const char *msg) ...@@ -143,6 +147,11 @@ void logv_std(Level level, const char *msg)
void logv(Level level, const char *format, va_list args) void logv(Level level, const char *format, va_list args)
{ {
if(static_cast<int>(level) < static_cast<int>(Level::SWIFTSHADER_LOGGING_LEVEL))
{
return;
}
#ifndef SWIFTSHADER_DISABLE_TRACE #ifndef SWIFTSHADER_DISABLE_TRACE
char buffer[2048]; char buffer[2048];
vsnprintf(buffer, sizeof(buffer), format, args); vsnprintf(buffer, sizeof(buffer), format, args);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment