WorldWind Source Analysis Series: Log class logs

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.