-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logger.cs
60 lines (55 loc) · 1.77 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
49
50
51
52
53
54
55
56
57
58
59
60
// --------------------------------------------------------------------------------
// VariScan module
//
// Description:
//
// Environment: Windows 10 executable, 32 and 64 bit
//
// Usage: TBD
//
// Author: (REM) Rick McAlister, [email protected]
//
// Edit Log: Rev 1.0 Initial Version
//
// Date Who Vers Description
// ----------- --- ----- -------------------------------------------------------
//
// ---------------------------------------------------------------------------------
//
using System;
using System.IO;
namespace VariScan
{
public class Logger
{
public Logger()
{
Configuration cfg = new Configuration();
if (cfg.LogFolder == "")
return;
string logfilename = DateTime.Now.ToString("yyyy_MM_dd") + ".log";
string logfilepath = cfg.LogFolder + "\\" + logfilename;
if (!Directory.Exists(cfg.LogFolder))
Directory.CreateDirectory(cfg.LogFolder);
if (!File.Exists(logfilename))
File.CreateText(logfilename);
return;
}
public void LogEntry(string upd)
{
Configuration cfg = new Configuration();
if (cfg.LogFolder == "")
return;
string logfilename = DateTime.Now.ToString("yyyy_MM_dd") + ".log";
string logfilepath = cfg.LogFolder + "\\" + logfilename;
System.IO.StreamWriter sys_sw;
if (!File.Exists(logfilepath))
sys_sw = File.CreateText(logfilepath);
else
sys_sw = new System.IO.StreamWriter(logfilepath, true);
sys_sw.WriteLine(DateTime.Now.ToString("HH:mm:ss") + " :: " + upd);
sys_sw.Close();
return;
}
}
}