Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

swlog.cpp

00001 //---------------------------------------------------------------------------
00002 
00003 #include <stdarg.h>
00004 #include <stdio.h>
00005 #ifndef _MSC_VER
00006 #include <iostream.h>
00007 #endif
00008 #include "swlog.h"
00009 //---------------------------------------------------------------------------
00010 
00011 
00012 SWLog *SWLog::systemlog = 0;
00013 
00014 
00015 class __staticsystemlog {
00016 public:
00017         __staticsystemlog() {
00018                 SWLog::systemlog = new SWLog();
00019         }
00020         ~__staticsystemlog() {
00021                 delete SWLog::systemlog;
00022         }
00023 } _staticsystemlog;
00024 
00025 
00026 void SWLog::LogWarning(char *fmt, ...)
00027 {
00028         char msg[2048];
00029         va_list argptr;
00030 
00031         if (log) {
00032                 va_start(argptr, fmt);
00033                 vsprintf(msg, fmt, argptr);
00034                 va_end(argptr);
00035 
00036 #ifndef _MSC_VER
00037                 cerr << msg;
00038                 cerr << "\n";
00039 #endif
00040         }
00041 }
00042 
00043 
00044 void SWLog::LogError(char *fmt, ...)
00045 {
00046         char msg[2048];
00047         va_list argptr;
00048 
00049         if (log) {
00050                 va_start(argptr, fmt);
00051                 vsprintf(msg, fmt, argptr);
00052                 va_end(argptr);
00053 
00054 #ifndef _MSC_VER
00055                 cerr << msg;
00056                 cerr << "\n";
00057 #endif
00058         }
00059 }
00060 
00061 
00062 void SWLog::LogTimedInformation(char *fmt, ...)
00063 {
00064         char msg[2048];
00065         va_list argptr;
00066 
00067         if (log) {
00068                 va_start(argptr, fmt);
00069                 vsprintf(msg, fmt, argptr);
00070                 va_end(argptr);
00071 
00072 #ifndef _MSC_VER
00073                 cout << msg;
00074                 cout << "\n";
00075 #endif
00076         }
00077 }
00078 
00079 
00080 void SWLog::LogInformation(char *fmt, ...)
00081 {
00082         char msg[2048];
00083         va_list argptr;
00084 
00085         if (log) {
00086                 va_start(argptr, fmt);
00087                 vsprintf(msg, fmt, argptr);
00088                 va_end(argptr);
00089 
00090 #ifndef _MSC_VER
00091                 cout << msg;
00092                 cout << "\n";
00093 #endif
00094         }
00095 } 

Generated on Thu Jun 20 22:13:00 2002 for The Sword Project by doxygen1.2.15