forked from MatheusGrijo/ArbitragemNacionalV2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logger.cs
51 lines (44 loc) · 1.03 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
/*
* Created by SharpDevelop.
* User: mifus_000
* Date: 20/05/2017
* Time: 15:46
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.IO;
/// <summary>
/// Description of Logger.
/// </summary>
public class Logger
{
public Logger()
{
}
public static void log(string value, string _prefix)
{
prefix = _prefix;
log(value);
}
static string prefix = "";
static Object objLock = new Object();
public static void log(string value)
{
value = "[" + DateTime.Now.ToString() + "] " + value;
lock (objLock)
{
Console.WriteLine(value);
try
{
System.IO.StreamWriter w = new StreamWriter(Program.location + DateTime.Now.ToString("yyyyMMdd") + "_logger_"+prefix+".txt", true);
w.WriteLine(value);
w.Close();
w.Dispose();
w = null;
}
catch
{ }
}
}
}