MongoDB C++ Driver  legacy-1.1.2
Public Member Functions | List of all members
mongo::logger::LogstreamBuilder Class Reference

Stream-ish object used to build and append log messages. More...

#include <logstream_builder.h>

Public Member Functions

 LogstreamBuilder (MessageLogDomain *domain, const std::string &contextName, LogSeverity severity)
 Construct a LogstreamBuilder that writes to "domain" on destruction. More...
 
 LogstreamBuilder (MessageLogDomain *domain, const std::string &contextName, LogSeverity severity, LogComponent component)
 Construct a LogstreamBuilder that writes to "domain" on destruction. More...
 
 LogstreamBuilder (MessageLogDomain *domain, const std::string &contextName, LabeledLevel labeledLevel)
 Deprecated.
 
 LogstreamBuilder (const LogstreamBuilder &other)
 Copies a LogstreamBuilder. More...
 
 ~LogstreamBuilder ()
 Destroys a LogstreamBuilder(). More...
 
LogstreamBuildersetBaseMessage (const std::string &baseMessage)
 Sets an optional prefix for the message.
 
void operator<< (Tee *tee)
 In addition to appending the message to _domain, write it to the given tee. More...
 

Detailed Description

Stream-ish object used to build and append log messages.

Constructor & Destructor Documentation

mongo::logger::LogstreamBuilder::LogstreamBuilder ( MessageLogDomain domain,
const std::string &  contextName,
LogSeverity  severity 
)

Construct a LogstreamBuilder that writes to "domain" on destruction.

"contextName" is a short name of the thread or other context. "severity" is the logging severity of the message.

mongo::logger::LogstreamBuilder::LogstreamBuilder ( MessageLogDomain domain,
const std::string &  contextName,
LogSeverity  severity,
LogComponent  component 
)

Construct a LogstreamBuilder that writes to "domain" on destruction.

"contextName" is a short name of the thread or other context. "severity" is the logging severity of the message. "component" is the primary log component of the message.

mongo::logger::LogstreamBuilder::LogstreamBuilder ( const LogstreamBuilder other)

Copies a LogstreamBuilder.

LogstreamBuilder instances are copyable only until the first call to stream() or operator<<.

TODO(schwerin): After C++11 transition, replace with a move-constructor, and make LogstreamBuilder movable.

mongo::logger::LogstreamBuilder::~LogstreamBuilder ( )

Destroys a LogstreamBuilder().

If anything was written to it via stream() or operator<<, constructs a MessageLogDomain::Event and appends it to the associated domain.

Member Function Documentation

void mongo::logger::LogstreamBuilder::operator<< ( Tee tee)

In addition to appending the message to _domain, write it to the given tee.

May only be called once per instance of LogstreamBuilder.


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