File: logbuffer.yo

package info (click to toggle)
bobcat 2.08.01-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 5,668 kB
  • ctags: 953
  • sloc: cpp: 10,403; makefile: 9,042; perl: 401; sh: 195
file content (115 lines) | stat: -rw-r--r-- 5,135 bytes parent folder | download
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
includefile(header.inc)

COMMENT(manpage, section, releasedate, archive, short name)
manpage(FBB::LogBuffer)(3bobcat)(_CurYrs_)(libbobcat1-dev__CurVers_-x.tar.gz)
                    (log messages stream buffer)

manpagename(FBB::LogBuffer)( bf(std::streambuf) handling log messages)

manpagesynopsis()
    bf(#include <bobcat/logbuffer>)nl()
    Linking option: tt(-lbobcat) 

manpagedescription()

    bf(FBB::LogBuffer) is a class derived from bf(std::streambuf) handling log
messages. The stream to log to, timestamps and log-levels can be configured
both at construction time and beyond. The bf(FBB::LogBuffer) may be used to
initialize a bf(std::ostream). 

includefile(namespace.inc)

manpagesection(INHERITS FROM)
    bf(std::streambuf)

manpagesection(ENUMERATION)
    The enumeration bf(TimeStamps) is defined in the namespace bf(FBB) to be
used when initializing bf(FBB::LogBuffer) objects. It has the following
values:
    itemization(
    itb(NOTIMESTAMPS)
        Log-messages will not have timestamps prepended to them.
    itb(TIMESTAMPS)
        Log-messages will have timestamps prepended to them.
    )

manpagesection(CONSTRUCTORS)
    itemization(
    itb(LogBuffer(TimeStamps timestamps = TIMESTAMPS,
                bool active = true,
                char const *delim = " "))
        This constructor constructs an bf(FBB::LogBuffer) object writing its
log-messages to bf(std::cerr). If the bf(active) parameter is initialized to
bf(false) no messages will be logged until the buffer's activity is switched
on (see bf(setActive()) below).  The parameter bf(delim) is inserted
immediately beyond the time stamp. If a delimiter is inappropriate, an empty
string or a 0-pointer may be specified. When bf(stamps == FBB::NOTIMESTAMPS
delim) is ignored. A time stamp consists of the month, the day number of the
month and the (local) time of the current message, as usually appearing in
messages in tt(/var/log) files. E.g., tt(Aug 5 13:52:23).
        itb(LogBuffer(std::ostream &stream, 
                TimeStamps timestamps = TIMESTAMPS,
                bool active = true,
                char const *delim = " "))
        This constructor constructs an bf(FBB::LogBuffer) object writing its
log-messages to the stream used to initialize its bf(stream) parameter. If the
bf(active) parameter is initialized to bf(false) no messages will be logged
until the buffer's activity is switched on (see bf(setActive()) below). The
parameter bf(delim) is inserted immediately beyond the time stamp. If a
delimiter is inappropriate, an empty string or a 0-pointer may be
specified. When bf(stamps == FBB::NOTIMESTAMPS delim) is ignored. A time stamp
consists of the month, the day number of the month and the (local) time of the
current message, as usually appearing in messages in tt(/var/log) files. E.g.,
tt(Aug 5 13:52:23).
    )
    The copy constructor is not available.

manpagesection(MEMBER FUNCTIONS)
     All members of bf(std::streambuf) are available, as bf(FBB::LogBuffer)
inherits from this class. 
    itemization(
    itb(void setStream(std::ostream &stream))
        This member may be used to switch the stream to log to. It is the
responsibility of the programmer to ensure that the external stream remains
available for as long as log-messages are inserted into it.
    itb(int overflow(int c))
    This member em(overrides) the bf(std::streambuf) member. It is
called by tt(std::ostream) objects using bf(OFdStreambuf). It calls
tt(sync()), an then it puts the next available character into the buffer. It
returns the inserted character.
    itb(int sync())
        This member em(overrides) the bf(std::streambuf) member. It writes
the buffer to the device associated with the file descriptor, and returns 0.
    itb(void setStream(bool active))
        The member function (de)activates logging. The argument bf(true)
activates logging, the argument bf(false) deactivates it.
    itb(void settimestamp(FBB::TimeStamps timestamps,
                char const *delim = " "))
        The member function (de)activates time stamp prepending. Use the value
bf(FBB::TIMESTAMPS) to prepend time stamps, bf(FBB::NOTIMESTAMPS) suppresses
time stamps.   A time stamp consists of the month, the day number of the month
and the (local) time of the current message, as usually appearing in messages
in tt(/var/log) files. E.g., tt(Aug 5 13:52:23). The parameter bf(delim) is
inserted immediately beyond the time stamp. If a delimiter is inappropriate,
an empty string or a 0-pointer may be specified. When bf(stamps ==
FBB::NOTIMESTAMPS delim) is ignored.
    itb(void setEmpty(bool empty))
        This member may be called to ensure that a timestamp is inserted
before the next insertion. It is called as bf(setEmpty(true)) when a newline
character (tt(\n)) is inserted, ensuring that another timestamp is prepended
before the next insertion.
    )

manpagesection(EXAMPLE)
    verbinclude(../../logbuffer/driver/driver.cc)

manpagefiles()
    em(bobcat/logbuffer) - defines the class interface

manpageseealso()
    bf(bobcat)(7), bf(log)(3bobcat)

manpagebugs()
    None Reported.

includefile(trailer.inc)