-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLogWriter.cs
More file actions
24 lines (23 loc) · 832 Bytes
/
LogWriter.cs
File metadata and controls
24 lines (23 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Diagnostics;
using System.IO;
namespace EnderIce2.SDRSharpPlugin
{
public static class LogWriter
{
public static void WriteToFile(string Message)
{
Debug.WriteLine(Message);
if (SDRSharp.Radio.Utils.GetBooleanSetting("LogRPC", false))
{
string path = AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
using StreamWriter sw = File.AppendText(AppDomain.CurrentDomain.BaseDirectory + "\\RPCLogs\\DiscordRPCLog_" + DateTime.Now.Date.ToShortDateString().Replace('/', '_') + ".log");
sw.WriteLine($"[{DateTime.Now}] {Message}");
}
}
}
}