-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogger.cs
37 lines (32 loc) · 897 Bytes
/
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
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ayoti
{
public static class Logger
{
private static StreamWriter swLog;
private const string sLOG_FILE_PATH = "log.txt";
static Logger()
{
Logger.OpenLogger();
}
public static void OpenLogger()
{
Logger.swLog = new StreamWriter(sLOG_FILE_PATH, false);
Logger.swLog.AutoFlush = true;
}
public static void LogThisLine(string sLogLine)
{
Logger.swLog.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "\t:" + "\t" + sLogLine);
Logger.swLog.Flush();
}
public static void CloseLogger()
{
Logger.swLog.Flush();
Logger.swLog.Close();
}
}
}