gem5 v25.0.0.1
Loading...
Searching...
No Matches
gem5::trace::OstreamLogger Class Reference

Logging wrapper for ostreams with the format: <when>: <name>: <message-body> More...

#include <trace.hh>

Inheritance diagram for gem5::trace::OstreamLogger:
gem5::trace::Logger

Public Member Functions

 OstreamLogger (std::ostream &stream_)
void logMessage (Tick when, const std::string &name, const std::string &flag, const std::string &message) override
 Log formatted message.
std::ostream & getOstream () override
 Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messages.
Public Member Functions inherited from gem5::trace::Logger
template<typename ... Args>
void dprintf (Tick when, const std::string &name, const char *fmt, const Args &...args)
 Log a single message.
template<typename ... Args>
void dprintf_flag (Tick when, const std::string &name, const std::string &flag, const char *fmt, const Args &...args)
 Log a single message with a flag prefix.
void dump (Tick when, const std::string &name, const void *d, int len, const std::string &flag)
 Dump a block of data of length len.
void setIgnore (ObjectMatch &ignore_)
 Set objects to ignore.
void addIgnore (const ObjectMatch &ignore_)
 Add objects to ignore.
void setActivate (ObjectMatch &activate_)
 Set objects to activate.
void addActivate (const ObjectMatch &activate_)
 Add objects to activate.
virtual ~Logger ()

Protected Attributes

std::ostream & stream
Protected Attributes inherited from gem5::trace::Logger
ObjectMatch ignore
 Name match for objects to ignore.
ObjectMatch activate
 Name match for objects to activate log.

Additional Inherited Members

Protected Member Functions inherited from gem5::trace::Logger
bool isEnabled (const std::string &name) const

Detailed Description

Logging wrapper for ostreams with the format: <when>: <name>: <message-body>

Definition at line 136 of file trace.hh.

Constructor & Destructor Documentation

◆ OstreamLogger()

gem5::trace::OstreamLogger::OstreamLogger ( std::ostream & stream_)
inline

Definition at line 142 of file trace.hh.

References stream.

Member Function Documentation

◆ getOstream()

std::ostream & gem5::trace::OstreamLogger::getOstream ( )
inlineoverridevirtual

Return an ostream that can be used to send messages to the 'same place' as formatted logMessage messages.

This can be implemented to use a logger's underlying ostream, to provide an ostream which formats the output in some way, or just set to one of std::cout, std::cerr

Implements gem5::trace::Logger.

Definition at line 148 of file trace.hh.

References stream.

◆ logMessage()

void gem5::trace::OstreamLogger::logMessage ( Tick when,
const std::string & name,
const std::string & flag,
const std::string & message )
overridevirtual

Log formatted message.

Implements gem5::trace::Logger.

Definition at line 148 of file trace.cc.

References gem5::ccprintf(), gem5::trace::Logger::isEnabled(), gem5::MaxTick, name(), gem5::print_backtrace(), STATIC_ERR, and stream.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().

Member Data Documentation

◆ stream

std::ostream& gem5::trace::OstreamLogger::stream
protected

Definition at line 139 of file trace.hh.

Referenced by getOstream(), logMessage(), and OstreamLogger().


The documentation for this class was generated from the following files:

Generated on Sat Oct 18 2025 08:07:04 for gem5 by doxygen 1.14.0