/usr/include/wvstreams/wvlogbuffer.h is in libwvstreams-dev 4.6.1-5.
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 76 77 78 79 80 81 | /* -*- Mode: C++ -*-
* Worldvisions Weaver Software:
* Copyright (C) 1997-2002 Net Integration Technologies, Inc.
*
*/
#ifndef __WVLOGBUFFER_H
#define __WVLOGBUFFER_H
#include "wvlogrcv.h"
#include "wvhashtable.h"
/**
* WvLogBuffer is a descendant of WvLogRcv that buffers log messages for
* later use. It only keeps up to max_lines log entries for every
* source/debug level, s.t. debug level <= max_level
*/
class WvLogBuffer : public WvLogRcv
{
public:
// An actual message
class Msg
{
public:
time_t timestamp;
WvLog::LogLevel level;
WvString source, message;
Msg(WvLog::LogLevel _level, WvStringParm _source, WvString _message);
};
DeclareWvList(Msg);
/*
* Maps a string describing msg type of the form "source:level"
* to a list of pointers to all messages of this type
*/
class MsgCounter
{
public:
MsgCounter(WvString _src_lvl) : src_lvl(_src_lvl) {};
Msg* add(Msg* msg, int max);
WvString src_lvl;
private:
MsgList list;
};
DeclareWvDict(MsgCounter, WvString, src_lvl);
protected:
/*
* "Owns" all the msges
*/
MsgList msgs;
/*
* Used for keeping track of how many messages from a given source/level
* there are. Just stores the pointers.
*/
MsgCounterDict counters;
WvDynBuf current;
int max_lines;
void handle_msg(Msg *lastmsg);
virtual void _begin_line() {};
virtual void _mid_line(const char *str, size_t len);
virtual void _end_line();
public:
WvLogBuffer(int _max_lines,
WvLog::LogLevel _max_level = WvLog::NUM_LOGLEVELS);
virtual ~WvLogBuffer();
MsgList &messages()
{ end_line(); return msgs; }
void feed_receiver(WvLogRcv& receiver);
void dump(WvStream &s);
};
#endif // __WVLOGBUFFER_H
|