base: Reimplement the DPRINTF mechanism in a Logger class
Review Request #2456 - Created Sept. 29, 2014 and submitted
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 10457:29dc41797b87 --------------------------- base: Reimplement the DPRINTF mechanism in a Logger class This patch adds a Logger class encapsulating dprintf. This allows variants of DPRINTF logging to be constructed and substituted in place of the default behaviour. The Logger provides a logMessage(when, name, format, ...) member function like Trace::dprintf and a getOstream member function to use a raw ostream for logging. A class OstreamLogger is provided which generates the customary debugging output with Trace::OstreamLogger::logMessage being the old Trace::dprintf.
Issue Summary
3
3
0
0
| Description | From | Last Updated | Status |
|---|---|---|---|
| This isn't necessary for stuff in base, right? | Nathan Binkert | Sept. 29, 2014, 6:19 a.m. | Open |
| This has the same static construction problem I described below. | Nathan Binkert | Sept. 29, 2014, 6:19 a.m. | Open |
| default_logger may not be constructed during a static constructor anymore, so if someone had log statements very early, things would ... | Nathan Binkert | Sept. 29, 2014, 6:19 a.m. | Open |
Posted (Sept. 29, 2014, 6:19 a.m.)
-
src/base/trace.cc (Diff revision 1) -
This isn't necessary for stuff in base, right?
-
src/base/trace.cc (Diff revision 1) -
This has the same static construction problem I described below.
-
src/base/trace.cc (Diff revision 1) -
default_logger may not be constructed during a static constructor anymore, so if someone had log statements very early, things would break. Consider something more like this: Logger *&debugLogger() { static OstreamLogger the_default(std::cerr); static Logger *the_logger = &the_default; return the_logger; }
Review request changed
Updated (Oct. 9, 2014, 7:33 a.m.)
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+175 -102) |
