base: Fix incorrect use of Logger::print
Previously when a formatted message was printed in a Logger it would use the wrong function, and thus skip the warning triggered by ccprintf. Fix this by merging two prints to avoid ambiguity. Change-Id: Idc51d2ef28ab4721d2be16f3e5fce19c494a0d47 Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41399 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
a70dc125d1
commit
763239ac32
@@ -90,24 +90,20 @@ class Logger
|
||||
|
||||
virtual ~Logger() {};
|
||||
|
||||
void
|
||||
print(const Loc &loc, const std::string &str)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << prefix << str;
|
||||
if (str.length() && str.back() != '\n' && str.back() != '\r')
|
||||
ss << std::endl;
|
||||
if (!enabled)
|
||||
return;
|
||||
log(loc, ss.str());
|
||||
}
|
||||
|
||||
template<typename ...Args> void
|
||||
print(const Loc &loc, const char *format, const Args &...args)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ccprintf(ss, format, args...);
|
||||
print(loc, ss.str());
|
||||
const std::string str = ss.str();
|
||||
|
||||
std::stringstream ss_formatted;
|
||||
ss_formatted << prefix << str;
|
||||
if (str.length() && str.back() != '\n' && str.back() != '\r')
|
||||
ss_formatted << std::endl;
|
||||
if (!enabled)
|
||||
return;
|
||||
log(loc, ss_formatted.str());
|
||||
}
|
||||
|
||||
template<typename ...Args> void
|
||||
|
||||
Reference in New Issue
Block a user