00001 /* 00002 * OstreamAppender.cpp 00003 * 00004 * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved. 00005 * Copyright 2000, Bastiaan Bakker. All rights reserved. 00006 * 00007 * See the COPYING file for the terms of usage and distribution. 00008 */ 00009 00010 #include "PortabilityImpl.hh" 00011 #ifdef LOG4CPP_HAVE_UNISTD_H 00012 # include <unistd.h> 00013 #endif 00014 #include <sys/types.h> 00015 #include <sys/stat.h> 00016 #include <fcntl.h> 00017 #include <log4cpp/OstreamAppender.hh> 00018 00019 namespace log4cpp { 00020 00021 OstreamAppender::OstreamAppender(const std::string& name, std::ostream* stream) : 00022 LayoutAppender(name), 00023 _stream(stream) { 00024 } 00025 00026 OstreamAppender::~OstreamAppender() { 00027 close(); 00028 } 00029 00030 void OstreamAppender::close() { 00031 // empty 00032 } 00033 00034 void OstreamAppender::_append(const LoggingEvent& event) { 00035 (*_stream) << _getLayout().format(event); 00036 if (!_stream->good()) { 00037 // XXX help! help! 00038 } 00039 } 00040 00041 bool OstreamAppender::reopen() { 00042 return true; 00043 } 00044 }