-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathLogging.cs
More file actions
23 lines (19 loc) · 775 Bytes
/
Logging.cs
File metadata and controls
23 lines (19 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
namespace TrexMinerGUI
{
public static class Logging
{
public static void WriteLog(MethodBase methodBase, string message)
{
string LogFilePath = Program.ExecutionPath + Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().Location) + ".log";
// The replace method is ugly, i know
string Tag = methodBase.DeclaringType.ToString().Replace("TrexMinerGUI.","") + "." + methodBase.Name;
string FinalLogMessage = String.Join(" ", DateTime.Now.ToString("s"), Tag + ":", message);
File.AppendAllText(LogFilePath, FinalLogMessage + Environment.NewLine);
}
}
}