Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
link against libsocket on qnx, add synchronous ostream appender
- Loading branch information
Showing
5 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* OstreamAppender.hh | ||
* | ||
* 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. | ||
*/ | ||
|
||
#ifndef _LOG4CPP_SYNCOSTREAMAPPENDER_HH | ||
#define _LOG4CPP_SYNCOSTREAMAPPENDER_HH | ||
|
||
#include <log4cpp/Portability.hh> | ||
#include <string> | ||
#include <iostream> | ||
#include <log4cpp/LayoutAppender.hh> | ||
#include <log4cpp/OstreamAppender.hh> | ||
|
||
namespace log4cpp { | ||
|
||
/** | ||
* SyncOstreamAppender appends LoggingEvents to ostreams and flushes immediately. | ||
**/ | ||
class LOG4CPP_EXPORT SyncOstreamAppender : public OstreamAppender { | ||
public: | ||
SyncOstreamAppender(const std::string& name, std::ostream* stream); | ||
virtual ~SyncOstreamAppender(); | ||
|
||
protected: | ||
virtual void _append(const LoggingEvent& event); | ||
}; | ||
} | ||
|
||
#endif // _LOG4CPP_SYNCOSTREAMAPPENDER_HH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* SyncOstreamAppender.cpp | ||
* | ||
* Copyright 2013, Aupeo GmbH. All rights reserved. | ||
* | ||
* See the COPYING file for the terms of usage and distribution. | ||
*/ | ||
|
||
#include "PortabilityImpl.hh" | ||
#ifdef LOG4CPP_HAVE_UNISTD_H | ||
# include <unistd.h> | ||
#endif | ||
#include <sys/types.h> | ||
#include <sys/stat.h> | ||
#include <fcntl.h> | ||
#include <log4cpp/SyncOstreamAppender.hh> | ||
|
||
namespace log4cpp { | ||
|
||
SyncOstreamAppender::SyncOstreamAppender(const std::string& name, std::ostream* stream) : | ||
OstreamAppender(name, stream) { | ||
} | ||
|
||
SyncOstreamAppender::~SyncOstreamAppender() { | ||
} | ||
|
||
void SyncOstreamAppender::_append(const LoggingEvent& event) { | ||
(*_stream) << _getLayout().format(event); | ||
if (_stream->good()) { | ||
(*_stream) << std::flush; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../../common.mk |