Fix log color, otherwise, the immediate line followed by the colored log will be tainted (#17329)

This commit is contained in:
cloudhan 2023-08-30 07:46:04 +08:00 committed by GitHub
parent c438360c1e
commit f3682eee3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,7 +46,7 @@ void OStreamSink::SendImpl(const Timestamp& timestamp, const std::string& logger
#endif
msg << timestamp << " [" << message.SeverityPrefix() << ":" << message.Category() << ":" << logger_id << ", "
<< message.Location().ToString() << "] " << message.Message() << "\n";
<< message.Location().ToString() << "] " << message.Message();
#ifndef ORT_MINIMAL_BUILD
if (message.Severity() == Severity::kWARNING ||
@ -55,6 +55,7 @@ void OStreamSink::SendImpl(const Timestamp& timestamp, const std::string& logger
msg << Color::kEnd;
}
#endif
msg << "\n";
(*stream_) << msg.str();
@ -87,7 +88,7 @@ void WOStreamSink::SendImpl(const Timestamp& timestamp, const std::string& logge
#endif
msg << timestamp << L" [" << message.SeverityPrefix() << L":" << message.Category() << L":" << ToWideString(logger_id) << L", "
<< ToWideString(message.Location().ToString()) << L"] " << ToWideString(message.Message()) << L"\n";
<< ToWideString(message.Location().ToString()) << L"] " << ToWideString(message.Message());
#ifndef ORT_MINIMAL_BUILD
if (message.Severity() == Severity::kWARNING ||
@ -96,6 +97,7 @@ void WOStreamSink::SendImpl(const Timestamp& timestamp, const std::string& logge
msg << Color::kLEnd;
}
#endif
msg << L"\n";
(*stream_) << msg.str();