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