zoukankan
html css js c++ java
VB.Net 中写Log 的方法
最近在项目中有用到写Log 的功能.用VB.Net写的.如下:
Code
1
Public
Sub WriteLog()
Sub
WriteLog(
ByVal
Msg
As
String
)
2
3
Dim
varAppPath
As
String
4
varAppPath
=
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase
+
"
log
"
5
System.IO.Directory.CreateDirectory(varAppPath)
6
7
Dim
head
As
String
8
head
=
System.DateTime.Now.Hour.ToString()
+
"
:
"
+
System.DateTime.Now.Minute.ToString()
9
head
=
head
+
"
:
"
+
System.DateTime.Now.Second.ToString()
+
"
:
"
+
System.DateTime.Now.Millisecond.ToString()
10
Msg
=
head
+
System.Environment.NewLine
+
Msg
+
System.Environment.NewLine
11
12
Dim
strDate
As
String
13
strDate
=
System.DateTime.Now.ToString(
"
yyyyMMdd
"
)
14
Dim
strFile
As
String
15
strFile
=
varAppPath
+
"
\
"
+
strDate
+
"
.log
"
16
Dim
SW
As
System.IO.StreamWriter
17
SW
=
New
System.IO.StreamWriter(strFile,
True
)
18
19
SW.WriteLine(Msg)
20
SW.Flush()
21
SW.Close()
22
23
End Sub
查看全文
相关阅读:
URAL 1948 H
int、long、long long取值范围
Bonetrousle HackerRank 数学 + 思维题
湖南省第十二届大学生计算机程序设计竞赛 problem A 2016
Abbreviation ---- hackerrank
POJ 3321 Apple Tree DFS序 + 树状数组
HDU
PICO CTF 2013 PHP 2: 85
XSS进阶三
XSS进阶二
原文地址:https://www.cnblogs.com/andycai/p/1448547.html
最新文章
漫长的补结题报告之路 poj3622
poj3041,poj2226
poj3月题解
poj1989
poj2135
poj2391,poj2455
poj1947
hdu 4788
poj 2236
codeforces 330b
热门文章
hdu 1251简单字典树
字典树
poj 2001
hdu 1075
hdu 1698区间延迟更新
hdu 4325
hdu 4325
Repair 暴力
HDU 5877 Weak Pair DFS + 树状数组 + 其实不用离散化
Solve Equations HackerRank 扩展欧几里德 && 数学
Copyright © 2011-2022 走看看