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
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>swlog.cpp Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.2.15 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> </center>
<hr><h1>swlog.cpp</h1><div class="fragment"><pre>00001 <font class="comment">//---------------------------------------------------------------------------</font>
00002
00003 <font class="preprocessor">#include <stdarg.h></font>
00004 <font class="preprocessor">#include <stdio.h></font>
00005 <font class="preprocessor">#ifndef _MSC_VER</font>
00006 <font class="preprocessor"></font><font class="preprocessor">#include <iostream.h></font>
00007 <font class="preprocessor">#endif</font>
00008 <font class="preprocessor"></font><font class="preprocessor">#include "swlog.h"</font>
00009 <font class="comment">//---------------------------------------------------------------------------</font>
00010
00011
00012 SWLog *SWLog::systemlog = 0;
00013
00014
00015 <font class="keyword">class </font>__staticsystemlog {
00016 <font class="keyword">public</font>:
00017 __staticsystemlog() {
00018 SWLog::systemlog = <font class="keyword">new</font> SWLog();
00019 }
00020 ~__staticsystemlog() {
00021 <font class="keyword">delete</font> SWLog::systemlog;
00022 }
00023 } _staticsystemlog;
00024
00025
00026 <font class="keywordtype">void</font> SWLog::LogWarning(<font class="keywordtype">char</font> *fmt, ...)
00027 {
00028 <font class="keywordtype">char</font> msg[2048];
00029 va_list argptr;
00030
00031 <font class="keywordflow">if</font> (log) {
00032 va_start(argptr, fmt);
00033 vsprintf(msg, fmt, argptr);
00034 va_end(argptr);
00035
00036 <font class="preprocessor">#ifndef _MSC_VER</font>
00037 <font class="preprocessor"></font> cerr << msg;
00038 cerr << <font class="stringliteral">"\n"</font>;
00039 <font class="preprocessor">#endif</font>
00040 <font class="preprocessor"></font> }
00041 }
00042
00043
00044 <font class="keywordtype">void</font> SWLog::LogError(<font class="keywordtype">char</font> *fmt, ...)
00045 {
00046 <font class="keywordtype">char</font> msg[2048];
00047 va_list argptr;
00048
00049 <font class="keywordflow">if</font> (log) {
00050 va_start(argptr, fmt);
00051 vsprintf(msg, fmt, argptr);
00052 va_end(argptr);
00053
00054 <font class="preprocessor">#ifndef _MSC_VER</font>
00055 <font class="preprocessor"></font> cerr << msg;
00056 cerr << <font class="stringliteral">"\n"</font>;
00057 <font class="preprocessor">#endif</font>
00058 <font class="preprocessor"></font> }
00059 }
00060
00061
00062 <font class="keywordtype">void</font> SWLog::LogTimedInformation(<font class="keywordtype">char</font> *fmt, ...)
00063 {
00064 <font class="keywordtype">char</font> msg[2048];
00065 va_list argptr;
00066
00067 <font class="keywordflow">if</font> (log) {
00068 va_start(argptr, fmt);
00069 vsprintf(msg, fmt, argptr);
00070 va_end(argptr);
00071
00072 <font class="preprocessor">#ifndef _MSC_VER</font>
00073 <font class="preprocessor"></font> cout << msg;
00074 cout << <font class="stringliteral">"\n"</font>;
00075 <font class="preprocessor">#endif</font>
00076 <font class="preprocessor"></font> }
00077 }
00078
00079
00080 <font class="keywordtype">void</font> SWLog::LogInformation(<font class="keywordtype">char</font> *fmt, ...)
00081 {
00082 <font class="keywordtype">char</font> msg[2048];
00083 va_list argptr;
00084
00085 <font class="keywordflow">if</font> (log) {
00086 va_start(argptr, fmt);
00087 vsprintf(msg, fmt, argptr);
00088 va_end(argptr);
00089
00090 <font class="preprocessor">#ifndef _MSC_VER</font>
00091 <font class="preprocessor"></font> cout << msg;
00092 cout << <font class="stringliteral">"\n"</font>;
00093 <font class="preprocessor">#endif</font>
00094 <font class="preprocessor"></font> }
00095 }
</pre></div><hr><address align="right"><small>Generated on Thu Jun 20 22:13:00 2002 for The Sword Project by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0
width=110 height=53></a>1.2.15 </small></address>
</body>
</html>
|