Commit 75066e7a by Jamie Madill Committed by Commit Bot

Clean up EVENT() logging.

These don't need newlines, or a severity prefix. BUG=angleproject:1660 Change-Id: I8a01c55a7e3d8915f48c2a29f43ddc0a37eb64f3 Reviewed-on: https://chromium-review.googlesource.com/443353Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent e6091987
...@@ -139,13 +139,13 @@ void LogMessage::trace() const ...@@ -139,13 +139,13 @@ void LogMessage::trace() const
} }
std::ostringstream stream; std::ostringstream stream;
stream << LogSeverityName(mSeverity) << ": "; // EVENT() does not require additional function(line) info.
// EVENT() don't require additional function(line) info
if (mSeverity != LOG_EVENT) if (mSeverity != LOG_EVENT)
{ {
stream << mFunction << "(" << mLine << "): "; stream << LogSeverityName(mSeverity) << ": " << mFunction << "(" << mLine << "): ";
} }
stream << mStream.str() << std::endl; stream << mStream.str();
std::string str(stream.str()); std::string str(stream.str());
if (DebugAnnotationsActive()) if (DebugAnnotationsActive())
...@@ -165,11 +165,18 @@ void LogMessage::trace() const ...@@ -165,11 +165,18 @@ void LogMessage::trace() const
if (mSeverity == LOG_ERR) if (mSeverity == LOG_ERR)
{ {
std::cerr << str; std::cerr << str << std::endl;
#if !defined(NDEBUG) && defined(_MSC_VER) }
#if defined(ANGLE_PLATFORM_WINDOWS) && \
(defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER) || !defined(NDEBUG))
#if !defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
if (mSeverity == LOG_ERR)
#endif // !defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
{
OutputDebugStringA(str.c_str()); OutputDebugStringA(str.c_str());
#endif // !defined(NDEBUG) && defined(_MSC_VER)
} }
#endif
#if defined(ANGLE_ENABLE_DEBUG_TRACE) #if defined(ANGLE_ENABLE_DEBUG_TRACE)
#if defined(NDEBUG) #if defined(NDEBUG)
...@@ -177,19 +184,14 @@ void LogMessage::trace() const ...@@ -177,19 +184,14 @@ void LogMessage::trace() const
{ {
return; return;
} }
#endif // NDEBUG #endif // defined(NDEBUG)
static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app); static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
if (file) if (file)
{ {
file.write(str.c_str(), str.length()); file << str << std::endl;
file.flush(); file.flush();
} }
#endif // defined(ANGLE_ENABLE_DEBUG_TRACE)
#if defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
OutputDebugStringA(str.c_str());
#endif // ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER
#endif // ANGLE_ENABLE_DEBUG_TRACE
} }
LogSeverity LogMessage::getSeverity() const LogSeverity LogMessage::getSeverity() const
......
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