Log class logs in the utility project are primarily used to output debug information in debug state. The class diagram for this class is as follows:
The classes and inline struct types used in log class log mainly have the following:
public class logeventargs:eventargs//Log event arguments
{
Public Int. level;
public string category;
public string message;
Public Logeventargs (int _l, string _c, String _m)
{
level = _l;
Category = _c;
message = _m;
}
}
Public struct levels//debug log level
{
public static readonly int Error = 0;
public static readonly int Warning = 2;
public static readonly int Debug = 5;
public static readonly int Verbose = 7;
};
The main fields, properties, and methods in log class log are:
Static StreamWriter logwriter;//Log write-down stream writer
static string logpath;//log path, default to "C:\Documents and settings\administrator\application data\nasa\world wind\1.4.0.0"
static string logfilepath;//log file path, logpath+ "WorldWind.log"
public static int level;//debug Log level
The methods are very simple, no longer detailed to repeat. Just a simple description of three of the commonly used log write-out functions:
public static void Write (Exception caught) static function is called in the program where any live exception is used to output the exception information to a text file with a "month-day time and minute.", and the default Exception Log output path is "c \ Documents and Settings\administrator\application data\nasa\world wind\1.4.0.0 ".
The public static void Debugwrite (Exception caught) static function is the same as the public static void Write (Exception caught) static function, except that the party program is in debug The exception information is only written in the state.
public static void Write (Int. level, string category, string message) static functions only log Levels <= Log.level (4 or 6) The log is written to the WorldWind.log file.
WorldWind Source Analysis Series: Log class logs