struct mrpt::system::COutputLogger::TMsg

Struct responsible of holding information relevant to the message (in std::string form) issued by the user.

Upon TMsg initialization, instance fetches the name of the caller COutputLogger, as well as the VerbosityLevel and the mrpt::Clock::time_point of the message provided. The format of the message when this is printed / or written to an external file complies is given below:

[name | level | timestamp:] body

struct TMsg
{
    //
fields

    mrpt::Clock::time_point timestamp;
    VerbosityLevel level;
    std::string name;
    std::string body;

    // construction

    TMsg(const mrpt::system::VerbosityLevel level, std::string_view msg, const COutputLogger& logger);

    //
methods

    std::string getAsString() const;
    void getAsString(std::string* contents) const;
    void writeToStream(std::ostream& out) const;
    void dumpToConsole() const;
};

Fields

mrpt::Clock::time_point timestamp

Timestamp of the message.

VerbosityLevel level

Verbosity level of the message.

std::string name

Name of the COutputLogger instance that called registered the message.

std::string body

Actual content of the message.

Construction

TMsg(const mrpt::system::VerbosityLevel level, std::string_view msg, const COutputLogger& logger)

Class constructor that passes a message in std::string form as well as a reference to the COutputLogger that provided the current message.

Methods

std::string getAsString() const

Return a string representation of the underlying message.

void getAsString(std::string* contents) const

Fill the string with the contents of the underlying message in string representation.

void writeToStream(std::ostream& out) const

Write the message contents to the specified stream.

See also:

getAsString

void dumpToConsole() const

Dump the message contents to the standard output.

See also:

writeToStream