vb生成log日志
如何在vb中生成log日志
Public Function writeText(ByVal str As String) '
Try
str &= ControlChars.CrLf
Dim fStream As FileStream
Dim sFileName As String
sFileName = Application.StartupPath & "\login.log"
fStream = New FileStream(sFileName, FileMode.Append)
Dim bWrite() As Byte = System.Text.Encoding.Default.GetBytes(str)
fStream.Write(bWrite, 0, bWrite.Length)
fStream.Flush()
fStream.Close()
fStream = Nothing
Catch ex As Exception
End Try
End Function
這個就可以寫日誌了!