Refer to the code of the Payment SDK, extract the WinForm storage Notepad log function:
#regionStorage Log Public stringPath = Application.startuppath +"/logs"; Private voidWritelog (stringTypestringClassName,stringcontent) { if(! Directory.Exists (PATH))//If the log directory does not exist, create{directory.createdirectory (path); } stringTime = DateTime.Now.ToString ("YYYY-MM-DD HH:mm:ss.fff");//get current system time stringfilename = path +"/"+ DateTime.Now.ToString ("YYYY-MM-DD") +". Log";//Name the log file by date//Create or open a log file to append records to the end of the log fileStreamWriter MYSW =file.appendtext (filename); //writing to a log file stringWrite_content = time +" "+ Type +" "+ ClassName +": "+content; Mysw.writeline (write_content); //Close log fileMysw.close (); } #endregion
Winfrom Storing TXT log functions