Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

OLOG.H Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

OLOG.H

Go to the documentation of this file.
00001 // Filename    : LOG.H
00002 // Description : Logging to locate hang
00003 
00004 #ifndef __LOG_H
00005 #define __LOG_H
00006 
00007 #include <OSTR.H>
00008 #include <OVQUEUE.H>
00009 
00010 //#define ENABLE_LOG
00011 
00012 #define DEBUG_LOG_GLOBAL 1
00013 // define DEBUG_LOG_LOCAL before #include <OLOG.H>
00014 // 1 to force enable debug log of that module, even though DEBUG_LOG_GLOBAL is 0
00015 // -1 to force disable debug log of that module, even though DEBUG_LOG_GLOBAL is 1
00016 // 0 to follow DEBUG_LOG_GLOBAL
00017 
00023 class Log {
00024 private:
00025     enum { LOG_VERSION = 12 };
00026     VLenQueue text_buffer[LOG_VERSION];
00027     String  log_text;
00028     String  log_file;
00029     int   log_line;
00030 
00031 public:
00032     Log();
00033     ~Log();
00034     void mark_begin();
00035     void mark_end();
00036     void mark(char *msg, char *file, int line);
00037     void mark(int n, char *file, int line);
00038     void dump();
00039 
00040     static void debug_log( char *msg );
00041     static void debug_log( int n );
00042 };
00043 
00044 extern Log msg_log;
00045 
00046 #if defined(DEBUG) && defined(ENABLE_LOG)
00047 #define LOG_BEGIN   msg_log.mark_begin()
00048 #define LOG_MSG(c)  msg_log.mark(c, __FILE__, __LINE__)
00049 #define LOG_END   msg_log.mark_end()
00050 #define LOG_DUMP    msg_log.dump()
00051 #else
00052 #define LOG_BEGIN
00053 #define LOG_MSG(c)
00054 #define LOG_END
00055 #define LOG_DUMP
00056 #endif
00057 
00058 // for local .cpp file
00059 #ifndef DEBUG_LOG_LOCAL
00060 #define DEBUG_LOG_LOCAL 0                         //-1
00061 #endif
00062 
00063 #if (DEBUG_LOG_GLOBAL + DEBUG_LOG_LOCAL > 0)
00064 #define DEBUG_LOG(c)  Log::debug_log(c)
00065 #else
00066 #define DEBUG_LOG(c)
00067 #endif
00068 #endif

Generated on Fri Aug 23 01:38:04 2002 for VirtualU by doxygen1.2.17