LogOut.cs
1007 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
namespace Model
{
public class LogOut
{
private readonly log4net.ILog log;
public System.Windows.Forms.TextBox LogBox { set; get; }
public LogOut(string name)
{
log = log4net.LogManager.GetLogger(name);
}
public void UIShow(string s)
{
if (LogBox == null) return;
string time = string.Format("[{0:HH:mm:ss}] ", DateTime.Now);
LogBox.AppendText(time + s + "\r\n");
LogBox.ScrollToCaret();
}
public void Error(string s, Exception ex)
{
log.Error(s, ex);
}
public void Debug(string s)
{
log.Debug(s);
}
public void Info(string s)
{
log.Info(s);
}
public void Fatal(string s, Exception ex)
{
log.Fatal(s, ex);
}
public void Warn(string s)
{
log.Warn(s);
}
}
}