1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
/*
* OstreamAppender.cpp
*
* Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.
* Copyright 2000, Bastiaan Bakker. All rights reserved.
*
* See the COPYING file for the terms of usage and distribution.
*/
#include "PortabilityImpl.hh"
#ifdef LOG4SHIB_HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <log4shib/OstreamAppender.hh>
namespace log4shib {
OstreamAppender::OstreamAppender(const std::string& name, std::ostream* stream) :
LayoutAppender(name),
_stream(stream) {
}
OstreamAppender::~OstreamAppender() {
close();
}
void OstreamAppender::close() {
// empty
}
void OstreamAppender::_append(const LoggingEvent& event) {
(*_stream) << _getLayout().format(event);
if (!_stream->good()) {
// XXX help! help!
}
}
bool OstreamAppender::reopen() {
return true;
}
}
|