base: Add LOC to Loggers

Printing the line and the file that triggered a log
is useful for debugging.

Change-Id: I74e0637b2943049134bd3e9a4bc6cab3766591a9
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42141
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:
Daniel R. Carvalho
2021-03-03 16:49:05 -03:00
committed by Daniel Carvalho
parent 6a7403f1a2
commit 8deb205ea1

View File

@@ -123,7 +123,12 @@ class Logger
bool enabled;
/** Generates the log message. By default it is sent to cerr. */
virtual void log(const Loc &loc, std::string s) { std::cerr << s; }
virtual void
log(const Loc &loc, std::string s)
{
std::cerr << loc.file << ":" << loc.line << ": " << s;
}
virtual void exit() { /* Fall through to the abort in exit_helper. */ }
const char *prefix;