zoukankan
html css js c++ java
一个简单的日志类,测试时候用
Code
1
class
LogWriter
2
{
3
private
static
string
path
=
Application.StartupPath
+
"
\\log.txt
"
;
4
static
LogWriter()
5
{
6
7
if
(
!
File.Exists(path))
8
{
9
FileStream fs
=
File.Create(path);
10
fs.Close();
11
}
12
13
Log(
"
Log Start:
"
);
14
}
15
16
public
static
void
Log(
string
str)
17
{
18
StreamWriter sw
=
File.AppendText(path);
19
sw.WriteLine(DateTime.Now.ToLongTimeString()
+
"
:
"
+
str);
20
sw.Close();
21
}
22
23
public
static
void
Error(
string
str)
24
{
25
StreamWriter sw
=
File.AppendText(path);
26
sw.WriteLine(DateTime.Now.ToLongTimeString()
+
"
: Error
"
+
str);
27
sw.Close();
28
}
29
}
查看全文
相关阅读:
适配器
JAVA对list集合进行排序Collections.sort()
ORACLE 日期加减操作
将TIMESTAMP类型的差值转化为秒的方法
Oracle 日期加减运算
legend3---阿里云配置cdn服务
legend3---阿里云添加 CNAME 记录提示和 A 记录冲突如何解决
legend3---laravel将静态资源转移到阿里云oss
legend3---laravel配置文件(自定义配置文件)
laravel 自定义常量方法
原文地址:https://www.cnblogs.com/gaomin/p/1294126.html
最新文章
hdu 5147 树状数组
螺旋矩阵算法
1.子查询知识体系,单行子查询,多行子查询
http协议与http代理
Clojure绘制UML
如何在cuda内核函数中产生随机数(host端调用,device端产生)
[翻译]CURAND Libaray--Host API--(2)
[翻译]CURAND Libaray--Host API--(1)
奋斗目标
C/C++ 遇到0xcccccccc访问冲突
热门文章
服务器负载监控以及文字处理脚本
DOS下修改IP地址
路由器的基本设置
oracle修改连接数
Oracle修改监听IP地址
前端js限制上传文件类型及大小(1)
android+nutz后台如何上传和下载图片
问答 请问使用OK("raw:jpg")能返回多张图片吗
关于nutz跨服务器上传文件
关于Content-Type: multipart/form-data的支持
Copyright © 2011-2022 走看看