新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
VB.NET寫Log方法詳細(xì)介紹
如果我們想使用VB.NET進(jìn)行代碼編寫的話,首先就要從基本概念開始了解,然后通過不斷的實(shí)踐練習(xí)來積累一定的運(yùn)用經(jīng)驗(yàn),才能很好的通過這款語言來實(shí)現(xiàn)我們需要的各種需求。下面就先來了解一下有關(guān)VB.NET寫Log方法的相關(guān)操作。#t#

創(chuàng)新互聯(lián)公司主營奎文網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營網(wǎng)站建設(shè)方案,成都app開發(fā),奎文h5微信小程序開發(fā)搭建,奎文網(wǎng)站營銷推廣歡迎奎文等地區(qū)企業(yè)咨詢
最近在項(xiàng)目中有用到VB.NET寫Log方法的功能.具體代碼如下:
Code
- Public Sub WriteLog()Sub
WriteLog(ByVal Msg As String) - Dim varAppPath As String
- varAppPath = System.AppDomain.
CurrentDomain.SetupInformation.
ApplicationBase + "log" - System.IO.Directory.CreateDirectory
(varAppPath) - Dim head As String
- head = System.DateTime.Now.Hour.
ToString() + ":" + System.DateTime.
Now.Minute.ToString() - headhead = head + ":" + System.DateTime.
Now.Second.ToString() + ":" +
System.DateTime.Now.Millisecond.ToString() - Msg = head + System.Environment.
NewLine + Msg + System.Environment.NewLine - Dim strDate As String
- strDate = System.DateTime.Now.
ToString("yyyyMMdd") - Dim strFile As String
- strFile = varAppPath + "\" +
strDate + ".log" - Dim SW As System.IO.StreamWriter
- SW = New System.IO.StreamWriter
(strFile, True) - SW.WriteLine(Msg)
- SW.Flush()
- SW.Close()
- End Sub
VB.NET寫Log方法相關(guān)代碼編寫方法就為大家介紹到這里。
網(wǎng)站欄目:VB.NET寫Log方法詳細(xì)介紹
轉(zhuǎn)載注明:http://fisionsoft.com.cn/article/cccejco.html


咨詢
建站咨詢
