#include <MsgUtil.h>
Collaboration diagram for MsgUtil:

Public Types | |
| enum | MsgType { TRACEMEM = 0, TRACE, VERBOSE, DEBUG, INFO, WARN } |
Static Public Member Functions | |
| static void | init (int argc, char **argv, const char *outFilename="runlog.txt") |
| static void | init (const char *filename, const char *outFilename="runlog.txt") |
| static void | setOutputMode (const bool printToFile=true, const bool printToScreen=true) |
| static void | printMsg (const char *classname, const char *funcname, const int linenum, const MsgType type, const char *msg) |
| static void | printfMsg (const char *classname, const char *funcname, const int linenum, const MsgType type, const char *fmt,...) |
| static void | printAssert (const char *condition, const char *funcname, int lineNum, const char *filename) |
Static Public Attributes | |
| static const int | ourNumTypes = 6 |
| static const char * | ourTypeNames [ourNumTypes] |
Static Protected Member Functions | |
| static int | typeBits (const MsgType type) |
| static void | enableClass (const char *classname, const int types) |
| static void | setType (const char *type, const bool flag) |
Static Protected Attributes | |
| static ofstream | outputFile |
| static bool | shouldPrintToFile = true |
| static bool | shouldPrintToScreen = true |
| static map< string, int > | classOverrides |
| static int | enabledTypes = 0 |
Disadvantages:
Message Levels:
Requirements to use:
Convinience macros:
File Format: If you provided a file with message level settings you can have any number of the following line types. If you have conflicting settings, the last setting will be used. You can start a line with '#' for a comment that will be ignored
Command line arguments: If you want to set message settings through the command line, you can use the -EnableType or -DisableType argument with any of the types. You can also use the argument -DebugClass with a classname.
In this mode the message system starts with WARN and INFO types turned on for all classes. The EnableType and DisableType arguments will turn on or off that message type for all classes. If a class is specified with the -DebugClass argument, that class will have all types turned on.
Debug vs Release build: To turn on the DEBUG VERBOSE TRACE and TRACEMEM message types, you have to compile with the _DEBUG_ flag set. Without this flag, the message macros will compile out.
This message system can either print to a wxMessageLog if you are using the wxWindows log (wxUSE_LOG defined; the default), or it can print to cout. If you are doing a windows application, you can setup a console to receive messages with the following code: FreeConsole(); AllocConsole(); freopen("CONIN$","rt",stdin); freopen("CONOUT$","wt",stdout); freopen("CONOUT$","wt",stderr); BringWindowToTop (GetConsoleHwnd()); SetConsoleTitle ("DrawStuff Messages");
Definition at line 114 of file MsgUtil.h.
|
|
|
|
||||||||||||
|
turn on a class by name. This turns on the given bitwise or of types Definition at line 88 of file MsgUtil.cpp. References classOverrides. Referenced by init(). |
|
||||||||||||
|
Initialized the message system with the given configuration file File Format: If you provide a file with message level settings you can have any number of the following line types. If you have conflicting settings, the last setting will be used. You can start a line with '#' for a comment that will be ignored:
If there is no file provided the following file is assumed as the default WARN 1 INFO 1 DEBUG 1 VERBOSE 0 TRACE 0 TRACEMEM 0 Definition at line 40 of file MsgUtil.cpp. References enableClass(), enabledTypes, INFO, ourNumTypes, ourTypeNames, outputFile, setType(), typeBits(), and WARN. Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Initialize the message system with the command line Command line arguments: If you want to set message settings through the command line, you can use the -EnableType or -DisableType argument with any of the types. You can also use the argument -DebugClass with a classname. In this mode the message system starts with WARN and INFO types turned on for all classes. The EnableType and DisableType arguments will turn on or off that message type for all classes. If a class is specified with the -DebugClass argument, that class will have all types turned on. Definition at line 19 of file MsgUtil.cpp. References classOverrides, DEBUG, enabledTypes, INFO, outputFile, setType(), TRACE, TRACEMEM, typeBits(), VERBOSE, and WARN. Referenced by ViewerApp::OnInit(). Here is the call graph for this function: ![]() |
|
||||||||||||||||||||
|
Definition at line 167 of file MsgUtil.cpp. |
|
||||||||||||||||||||||||||||
|
Send a message to the log. This function is normally called through the macros defined in this class. However, you can call this function directly if you want
Definition at line 107 of file MsgUtil.cpp. References classOverrides, enabledTypes, ourTypeNames, outputFile, shouldPrintToFile, shouldPrintToScreen, and typeBits(). Referenced by printMsg(). Here is the call graph for this function: ![]() |
|
||||||||||||||||||||||||
|
Send a message to the log. This function is normally called through the macros defined in this class. However, you can call this function directly if you want
Definition at line 161 of file MsgUtil.cpp. References printfMsg(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Set the output modes
Definition at line 184 of file MsgUtil.h. References shouldPrintToFile, and shouldPrintToScreen. |
|
||||||||||||
|
turn on or off a particular type. This sets the default for all classes for that type. A class can overrride this default with the enable class function call. Definition at line 93 of file MsgUtil.cpp. References enabledTypes, ourNumTypes, and ourTypeNames. Referenced by init(). |
|
|
get the bitwise representation of the given message type Definition at line 221 of file MsgUtil.h. Referenced by init(), and printfMsg(). |
|
|
Map of string class name to a bitwise or of the types that are turned on for that class Definition at line 236 of file MsgUtil.h. Referenced by enableClass(), init(), and printfMsg(). |
|
|
bitwise or of all the types that are enabled for all classes Definition at line 240 of file MsgUtil.h. Referenced by init(), printfMsg(), and setType(). |
|
|
|
|
|
Initial value:
{"TRACEMEM", "TRACE","VERBOSE","DEBUG","INFO","WARN"}
Definition at line 119 of file MsgUtil.h. Referenced by init(), printfMsg(), and setType(). |
|
|
Definition at line 121 of file MsgUtil.h. Referenced by init(), and printfMsg(). |
|
|
Definition at line 122 of file MsgUtil.h. Referenced by printfMsg(), and setOutputMode(). |
|
|
Definition at line 123 of file MsgUtil.h. Referenced by printfMsg(), and setOutputMode(). |
1.4.5