/usr/include/bobcat/logbuffer is in libbobcat-dev 3.23.01-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | #ifndef INCLUDED_BOBCAT_LOGBUFFER_
#define INCLUDED_BOBCAT_LOGBUFFER_
#include <streambuf>
#include <ostream>
#include <string>
namespace FBB
{
enum TimeStamps
{
NOTIMESTAMPS,
TIMESTAMPS,
UTCTIMESTAMPS
};
class LogBuffer: public std::streambuf
{
std::ostream *d_stream; // the stream to insert info to
TimeStamps d_timestamps;// what timestamp to use?
bool d_active; // actually write information or not
bool d_empty; // set to true at the beginning, after writing \n
std::string d_delim; // delimiter following time stamps
public:
explicit LogBuffer( // output to cerr
TimeStamps timestamps = TIMESTAMPS,
bool active = true,
char const *delim = " ");
explicit LogBuffer(std::ostream &stream,
TimeStamps timestamps = TIMESTAMPS,
bool active = true,
char const *delim = " ");
void setStream(std::ostream &stream); // .f
bool empty() const; // .f
void setActive(bool active); // .f
void settimestamp(TimeStamps timestamps, char const *delim = " ");
void setEmpty(bool empty); // .f
protected:
virtual int pSync();
private:
virtual int sync();
virtual int overflow(int c);
void insertTimestamp();
LogBuffer(LogBuffer const &other) = delete;
LogBuffer &operator=(LogBuffer const &other) = delete;
};
inline bool LogBuffer::empty() const
{
return d_empty;
}
inline void LogBuffer::setActive(bool active)
{
d_active = active;
}
inline void LogBuffer::setEmpty(bool empty)
{
d_empty = empty;
}
inline void LogBuffer::setStream(std::ostream &stream)
{
d_stream = &stream;
}
} // FBB
#endif
|