MessageLogger.cc
Go to the documentation of this file.
1 #include <utl/MessageLogger.h>
2 
3 
4 namespace utl {
5 
6  /*
7  * Regarding the destructor for Message.
8  *
9  * Note that we're not making a mistake as
10  * using the character directly (in the sense
11  * of using LF in a CR/LF environment).
12  * Using text-mode the character gets
13  * translated to the plattform-specific
14  * end-of-line.
15  * The difference with std::endl is that
16  * this one is not a character, it's a
17  * manipulator function which, in addition
18  * to inserting \n, flushes the stream:
19  * that's what we're losing as using the char.
20  *
21  * Check the standards:
22  *
23  * C (ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007)
24  *
25  * 5.2.2 Character display semantics
26  * (2) \n (new line) Moves the active position to the initial position of the next line.
27  * (3) Each of these escape sequences shall produce a unique implementation-defined value
28  * which can be stored in a single char object. The external representations in a text file
29  * need not be identical to the internal representations, and are outside the scope of this
30  * International Standard.
31  *
32  * 7.19.2 Streams
33  * (2) Characters may have to be added, altered, or deleted on input and output to conform
34  * to differing conventions for representing text in the host environment. Thus, there need
35  * not be a one-to-one correspondence between the characters in a stream and those in the
36  * external representation.
37  *
38  *
39  * C++ (ISO/IEC 14882:2003(E))
40  *
41  * Table 5—escape sequences
42  *
43  * 27.6.2.7 Standard basic_ostream manipulators
44  * For endl it's said:
45  * Calls os.put(os.widen(’\n’) ), then os.flush().
46  *
47  * 27.8 File-based streams
48  * (2) The restrictions on reading and writing a sequence controlled by an object of class
49  * basic_filebuf<charT,traits> are the same as for reading and writing with the Standard C
50  * library FILEs.
51  */
52 
53  MessageLogger::MessageLogger(std::ostream& os, unsigned int l) :
54  fStream(os),
55  fLevel(l),
56  fFlushCounter(0),
57  fFlushPeriod(0)
58  { }
59 
60 }
MessageLogger(std::ostream &os, unsigned int l)
Construct a logger to handle the messages.

, generated on Tue Sep 26 2023.