If nothing ever went wrong in WindowMud, a log containing server events would not be necessary. But, as mere mortals, it is expected that problems will occur and need to be logged. A class called Log is used to handle the logging functions. Log.h and Log.cpp hold the log class definition and functions. Within the MSVC IDE, Log.h goes in the Server Header Files folder and Log.cpp goes in the Server Source Files. Under Class View, the Log class is placed in the Server folder.
A new folder, within the \WindowMud directory, called Log will hold the server log files. The placement of the Log folder is \WindowMud\Running\Log. Each time WindowMud is started, the existing ServerLog.txt file is renamed by embedding the result of a call to CTime::GetCurrentTime in the file name, for example ServerLog.txt becomes ServerLog.1087928062.txt, and a new ServerLog.txt is created.
The new Log class enables any event, whether good or bad, to be logged via a simple call to LogIt. Below, in red, is the code added to BigDog.h and BigDog.cpp to cause Start and Stop events to be logged.
WindowMud aquired the abililty to log events, a useful feature for debugging and administration. Adding new classes to WindowMud will follow the pattern used to add the Log class, keeping WindowMud's code organized.
After downloading and unzipping the project, ensure that it is in the C:\WindowMud directory or change the HomeDir variable assignment to match the chosen directory.
Download the WindowMud project