Support for command line arguments (#155)

This commit is contained in:
2023-06-18 18:02:02 +08:00
parent aabe6664b4
commit b2b656b6cb
5 changed files with 244 additions and 8 deletions

View File

@@ -25,16 +25,17 @@ namespace GrasscutterTools.Utils
{
public static class Logger
{
public static bool IsSaveLogs = false;
private static readonly string LogPath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), $"GcTools-{DateTime.Now:MMdd}.log");
private static void Write(string message)
{
#if DEBUG
Console.WriteLine($"{DateTime.Now:mm:ss.fff} {message}");
#else
// Test log
//File.AppendAllText(LogPath, $"{DateTime.Now:mm:ss.fff} {message}{Environment.NewLine}");
#endif
if (IsSaveLogs)
{
Console.WriteLine($"{DateTime.Now:mm:ss.fff} {message}");
File.AppendAllText(LogPath, $"{DateTime.Now:mm:ss.fff} {message}{Environment.NewLine}");
}
}
private static void Write(string level, string tag, string message) => Write($"<{level}:{tag}> {message}");