-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.cs
48 lines (42 loc) · 1.07 KB
/
Logger.cs
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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Gitalarmi
{
class Logger
{
private string path = "";
private static string rootPath = "C:\\gitAlarmiLog";
private static string LogPath
{
get
{
return rootPath;
}
}
public Logger()
{
this.path = LogPath + DateTime.Today.ToString("yyyyMM") + "\\";
if (Directory.Exists(this.path) == false)
{
Directory.CreateDirectory(this.path);
}
this.path += DateTime.Today.ToString("yyyyMMdd") + ".cart_auto_order.log";
}
public void WriteErrorLog(string strLog)
{
try
{
StreamWriter sw = new StreamWriter(this.path, true, Encoding.Default);
sw.WriteLine(strLog + "\n");
sw.Close();
}
catch (Exception)
{
}
}
}
}