Make abort on LOG_TRAP opt-in

A developer can change SWIFTSHADER_LOG_LEVEL to Debug or Verbose to make
LOG_TRAP abort when a debugger is attached. This keeps debugging easy in
most circumstances where devs don't care about unsupported struct
extensions. But it still allows devs to go right to where an unsupported
structure is being used if they so desire.

Bug: b/169868497
Change-Id: I916506ee557f8de01516fe4efb33044c2367db77
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/49288
Reviewed-by: Alexis Hétu <sugoi@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by: Sean Risser <srisser@google.com>
diff --git a/src/System/Debug.cpp b/src/System/Debug.cpp
index df7ab45..838d58d 100644
--- a/src/System/Debug.cpp
+++ b/src/System/Debug.cpp
@@ -219,9 +219,10 @@
 	// If enabled, log_assert will log all messages, and otherwise ignore them
 	// unless a debugger is attached.
 	static std::atomic<bool> asserted = { false };
-	if(IsUnderDebugger() && !asserted.exchange(true))
+	if(IsUnderDebugger() && !asserted.exchange(true) && static_cast<int>(Level::Debug) >= static_cast<int>(Level::SWIFTSHADER_LOGGING_LEVEL))
 	{
-		// Abort after tracing and printing to stderr
+		// If a developer wants to be aware of what's happening,
+		// then we abort after tracing and printing to stderr
 		va_list vararg;
 		va_start(vararg, format);
 		logv(Level::Fatal, format, vararg);