C 通用類 日誌記錄類

2021-09-08 22:38:26 字數 1068 閱讀 5754

using

system;

using

system.collections.generic;

using

system.io;

using

system.linq;

using

system.text;

using

system.threading.tasks;

using

system.web;

namespace

ktcommon.log

#region

//將顯示的提示資訊寫到log檔案

public

void trace(string

tipmsg)

public

void trace(string nodetime, string

tipmsg)

//log目錄不存在,則建立

if (directory.exists(filepath) == false

)

m_logfilepath = filepath +filename;

//日誌檔案不存在,則建立

if (file.exists(filepath + filename) == false

)

file.create(filepath +filename).close();

sw = new streamwriter(filepath + filename, true

, encoding.utf8);

}//建立例項

if (sw == null

)

//將內容寫到log檔案中

sw.writeline(nodetime +tipmsg);

//重新整理,實時儲存

sw.flush();

}catch

(exception ex)

}#endregion

//將訊息寫到log檔案

}}

C 通用類 日誌記錄類

using system using system.collections.generic using system.io using system.linq using system.text using system.threading.tasks using system.web namesp...

C 通用輸出類

using system using system.collections.generic using system.linq using system.web using system.xml.serialization using xiaofeng using newtonsoft.json u...

c 操作mysql通用類 C 資料庫操作通用類

usingsystem usingsystem.collections.generic usingsystem.linq usingsystem.text usingsystem.data.common usingsystem.data usingsystem.reflection namespac...