forked from Scootin159/vault2git
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLog.cs
More file actions
69 lines (53 loc) · 1.37 KB
/
Log.cs
File metadata and controls
69 lines (53 loc) · 1.37 KB
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
61
62
63
64
65
66
67
68
69
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace vault2git
{
class Log : IDisposable
{
#region Static Attributes
private static StreamWriter logfile = null;
#endregion
#region Static Properties
private static string DateStamp { get { return DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } }
#endregion
#region Public Static Methods
public static void Info(string message)
{
Console.Write(DateStamp);
Console.Write(": ");
Console.WriteLine(message);
Debug(message);
}
public static void Debug(string message)
{
logfile.Write(DateStamp);
logfile.Write(": ");
logfile.WriteLine(message);
logfile.Flush();
}
#endregion
#region Constructor
public Log()
{
if (logfile == null)
{
logfile = new StreamWriter(Program.options.LogFilePath);
}
}
#endregion
#region IDisposable Members
public void Dispose()
{
if (logfile != null)
{
logfile.Close();
logfile = null;
}
}
#endregion
}
}