36 #ifndef __BASE_TRACE_HH__
37 #define __BASE_TRACE_HH__
59 template <
typename ...Args>
66 std::ostringstream line;
73 const void *
d,
int len);
77 const std::string &message) = 0;
104 const std::string &message)
override;
136 const std::string &
name();
164 #define DTRACE(x) (Debug::x)
166 #define DDUMP(x, data, count) do { \
167 using namespace Debug; \
169 Trace::getDebugLogger()->dump(curTick(), name(), data, count); \
172 #define DPRINTF(x, ...) do { \
173 using namespace Debug; \
175 Trace::getDebugLogger()->dprintf(curTick(), name(), \
180 #define DPRINTFS(x, s, ...) do { \
181 using namespace Debug; \
183 Trace::getDebugLogger()->dprintf(curTick(), s->name(), \
188 #define DPRINTFR(x, ...) do { \
189 using namespace Debug; \
191 Trace::getDebugLogger()->dprintf((Tick)-1, std::string(), \
196 #define DDUMPN(data, count) do { \
197 Trace::getDebugLogger()->dump(curTick(), name(), data, count); \
200 #define DPRINTFN(...) do { \
201 Trace::getDebugLogger()->dprintf(curTick(), name(), __VA_ARGS__); \
204 #define DPRINTFNR(...) do { \
205 Trace::getDebugLogger()->dprintf((Tick)-1, string(), __VA_ARGS__); \
210 #define DTRACE(x) (false)
211 #define DDUMP(x, data, count) do {} while (0)
212 #define DPRINTF(x, ...) do {} while (0)
213 #define DPRINTFS(x, ...) do {} while (0)
214 #define DPRINTFR(...) do {} while (0)
215 #define DDUMPN(data, count) do {} while (0)
216 #define DPRINTFN(...) do {} while (0)
217 #define DPRINTFNR(...) do {} while (0)
221 #endif // __BASE_TRACE_HH__
void ccprintf(cp::Print &print)
const std::string & name() const
std::ostream & getOstream() override
Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messa...
bool match(const std::string &name) const
StringWrap(const std::string &s)
void setIgnore(ObjectMatch &ignore_)
Set objects to ignore.
const std::string & operator()() const
const std::string & name()
virtual std::ostream & getOstream()=0
Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messa...
OstreamLogger(std::ostream &stream_)
uint64_t Tick
Tick count type.
Debug logging base class.
ObjectMatch ignore
Name match for objects to ignore.
std::ostream & output()
Get the ostream from the current global logger.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
Logging wrapper for ostreams with the format: <when>: <name>: <message-body>
Logger * getDebugLogger()
Get the current global debug logger.
void logMessage(Tick when, const std::string &name, const std::string &message) override
Log formatted message.
void enable()
Enable/disable debug logging.
virtual void logMessage(Tick when, const std::string &name, const std::string &message)=0
Log formatted message.
void setDebugLogger(Logger *logger)
Delete the current global logger and assign a new one.
Named(const std::string &name_)
void dprintf(Tick when, const std::string &name, const char *fmt, const Args &...args)
Log a single message.
virtual void dump(Tick when, const std::string &name, const void *d, int len)
Dump a block of data of length len.