21 #include "mongo/base/status.h"
22 #include "mongo/logger/message_log_domain.h"
33 LogDomain<E>::LogDomain()
34 : _abortOnFailure(false) {}
37 LogDomain<E>::~LogDomain() {
43 for (
typename AppenderVector::const_iterator iter = _appenders.begin();
44 iter != _appenders.end();
47 Status status = (*iter)->append(event);
49 if (_abortOnFailure) {
61 typename LogDomain<E>::AppenderAutoPtr appender) {
62 typename AppenderVector::iterator iter =
63 std::find(_appenders.begin(), _appenders.end(),
static_cast<EventAppender*
>(NULL));
65 if (iter == _appenders.end()) {
66 _appenders.push_back(appender.release());
69 *iter = appender.release();
78 AppenderAutoPtr result(appender);
85 for (
typename AppenderVector::const_iterator iter = _appenders.begin();
86 iter != _appenders.end();
Status represents an error state or the absence thereof.
Definition: status.h:50
void clearAppenders()
Destroy all attached appenders, invalidating all handles.
Definition: log_domain-impl.h:84
Utility functions for parsing numbers from strings.
Definition: compare_numbers.h:20
AppenderHandle attachAppender(AppenderAutoPtr appender)
Attaches "appender" to this domain, taking ownership of it.
Definition: log_domain-impl.h:60
AppenderAutoPtr detachAppender(AppenderHandle handle)
Detaches the appender referenced by "handle" from this domain, releasing ownership of it...
Definition: log_domain-impl.h:75
Interface for sinks in a logging system.
Definition: appender.h:31
Opaque handle returned by attachAppender(), which can be subsequently passed to detachAppender() to d...
Definition: log_domain.h:61
Status append(const Event &event)
Receives an event for logging, calling append(event) on all attached appenders.
Definition: log_domain-impl.h:42