diff --git a/deps/ox/src/ox/trace/trace.cpp b/deps/ox/src/ox/trace/trace.cpp index 0fe09a95..a590a446 100644 --- a/deps/ox/src/ox/trace/trace.cpp +++ b/deps/ox/src/ox/trace/trace.cpp @@ -17,6 +17,8 @@ namespace ox::trace { +static const auto OxPrintTrace = std::getenv("OXTRACE") != nullptr; + OutStream::OutStream(const char *file, int line, const char *ch, const char *msg) { m_msg.file = file; m_msg.line = line; @@ -41,9 +43,11 @@ StdOutStream::StdOutStream(const char *file, int line, const char *ch, const cha StdOutStream::~StdOutStream() { #if defined(OX_USE_STDLIB) - std::cout << std::setw(53) << std::left << m_msg.ch.c_str() << '|'; - std::cout << std::setw(65) << std::left << m_msg.msg.c_str() << '|'; - std::cout << " " << m_msg.file.c_str() << ':' << m_msg.line << "\n"; + if (OxPrintTrace) { + std::cout << std::setw(53) << std::left << m_msg.ch.c_str() << '|'; + std::cout << std::setw(65) << std::left << m_msg.msg.c_str() << '|'; + std::cout << " " << m_msg.file.c_str() << ':' << m_msg.line << "\n"; + } #endif }