blob: 9f51a852fe1a905706360eb4370b8c50c63461d6 (
plain)
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
|
<!DOCTYPE HTML PUBLIC>
<HTML>
<TITLE>Xbase DBMS Chapter 13</TITLE>
<BODY BGCOLOR=#FFFFFF>
<H2><p align="center">Logfiles</p></H2>
<p align="center">Chapter Updated 11/29/22</p><hr>
<h3>Logging</h3>
The Xbase library includes a logging module that can be turned on or off for auditing purposes.
See example code below for how to use the logging routines.
<hr>
#include "xbase.h"<br>
using namespace xb;<br>
<br>
int main( int argCnt, char **av ){<br>
#ifdef XB_LOGGING_SUPPORT<br>
xbString sMsg;<br>
xbString sLogFileName;<br>
xbXBase x;<br>
sLogFileName = "/home/xbase/logfiles/LogFile.txt";<br>
x.SetLogFileName( sLogFileName );<br>
x.EnableMsgLogging(); <br><br>
std::cout << "Logfile is [" << x.GetLogFqFileName().Str() << "]" << std::endl;<br>
sMsg.Sprintf( "Program [%s] initializing...", av[0] );<br>
x.WriteLogMessage( sMsg );<br>
std::cout << "Logging status is " << x.GetLogStatus() << std::endl;<br>
sMsg = "A logfile message";<br>
x.WriteLogMessage( sMsg );<br>
x.DisableMsgLogging();<br>
#endif /* XB_LOGGING_SUPPORT */<br>
return 0;<br>
}<br>
<hr>
<p><img src="xbase.jpg"><hr>
</BODY>
</HTML>
|