ProgramIf a problem occurs, or you want to record the test and tracking information, you can capture sensitive information and email it to the author. In actual operations, most logs are used.
. Net Framework has debug, and the trace class can do this. It is lightweight and good, and does not require additional classes. However, it is slightly insufficient to handle logs with complicated requirements, I have written a logging class. Even if I cannot make it a good experience, I believe it will not be a burden.
Introduction:
Writelog is a base class that defines common variables and methods;
Writetxtlog: inherits writelog and provides the method to write information to a TXT file;
Timer2txt: inherits writetxtlog and provides a public arraylist to process information in arraylist. The objective is to process a large amount of data. When multiple methods have log processing requirements, all log information is placed in arraylist, it is processed independently by timer2txt to prevent concurrent writes to the same log and exclusively process the logs.
Writexmllog: simple function. It only writes information to an XML file and needs to be further improved.
The above classes can be used at will. The methods are public and determined based on actual needs.
Strongname can be stored in GAC. Therefore, variables and methods in the class can be instantiated without static.
Download: pierce.log.rar