source: trunk/MagicSoft/Mars/mbase/MLogManip.cc@ 729

Last change on this file since 729 was 604, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 2.8 KB
Line 
1#include "MLog.h"
2#include "MLogManip.h"
3
4// ----------------------------------------------------------------
5// Definitions of the manipulator functions
6// ----------------------------------------------------------------
7
8ostream& __omanip_debug(ostream& lout, int i)
9{
10 //
11 // get the streambuf of the stream
12 // get the pointer to the parent class by casting
13 // set the output level of the logging stream
14 //
15 // Be careful: This manipulator can only be used in MLogging
16 // streams - in other streams SetOutputLevel is a call
17 // of a non existing function
18 //
19 // Be careful 2: The change is valid for everything which is
20 // in the present buffer. This means it can also affect a
21 // part of the stream which is already in the stream but not flushed
22 // to the output device. A flush occures either if you tell a stream
23 // to flush (flush, endl) or if an buffer overflow occures, the
24 // last behaviour could be changed if someone want to have a dynamic
25 // buffer.
26 //
27 MLog *log=(MLog*)lout.rdbuf();
28// cout << " -" << i << "- ";
29 log->SetOutputLevel(i);
30 return lout;
31}
32
33ostream& __omanip_device(ostream& lout, int i)
34{
35 //
36 // get the streambuf of the stream
37 // get the pointer to the parent class by casting
38 // set the output device of the logging stream, more than
39 // one output device can be ored together
40 //
41 // Be careful: This manipulator can only be used in MLogging
42 // streams - in other streams SetOutputLevel is a call
43 // of a non existing function
44 //
45 MLog *log=(MLog*)lout.rdbuf();
46 log->SetOutputDevice(i);
47 return lout;
48}
49
50ostream& __omanip_edev(ostream& lout, int i)
51{
52 //
53 // get the streambuf of the stream
54 // get the pointer to the parent class by casting
55 // Enable an output device of the logging stream, it should
56 // be possible to enable more than one output device at the
57 // same time by oring them together
58 //
59 // Be careful: This manipulator can only be used in MLogging
60 // streams - in other streams SetOutputLevel is a call
61 // of a non existing function
62 //
63 MLog *log=(MLog*)lout.rdbuf();
64 log->EnableOutputDevice((MLog::_flags)i);
65 return lout;
66}
67
68ostream& __omanip_ddev(ostream& lout, int i)
69{
70 //
71 // get the streambuf of the stream
72 // get the pointer to the parent class by casting
73 // Disable an output device of the logging stream, it should
74 // be possible to disable more than one output device at the
75 // same time by oring them together
76 //
77 // Be careful: This manipulator can only be used in MLogging
78 // streams - in other streams SetOutputLevel is a call
79 // of a non existing function
80 //
81 MLog *log=(MLog*)lout.rdbuf();
82 log->DisableOutputDevice((MLog::_flags)i);
83 return lout;
84}
85
Note: See TracBrowser for help on using the repository browser.