Skip to content

Commit 54134e9

Browse files
committed
feat: 增加打开log选项
1 parent e1ecfe3 commit 54134e9

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

TuneLab/PathManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ internal static class PathManager
1717
public static string SettingsFilePath => Path.Combine(ConfigsFolder, "Settings.json");
1818
public static string ExtensionsFolder => Path.Combine(TuneLabFolder, "Extensions");
1919
public static string LockFilePath => Path.Combine(TuneLabFolder, "TuneLab.lock");
20-
20+
public static string LogFilePath { get { mLogFilePath ??= Path.Combine(LogsFolder, "TuneLab_" + DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss") + ".log"); return mLogFilePath; } }
2121
public static string ExcutableFolder => AppDomain.CurrentDomain.BaseDirectory;
2222
public static string ResourcesFolder => Path.Combine(ExcutableFolder, "Resources");
2323
public static string TranslationsFolder => Path.Combine(ResourcesFolder, "Translations");
@@ -27,4 +27,6 @@ public static void MakeSureExist(string folder)
2727
if (!Directory.Exists(folder))
2828
Directory.CreateDirectory(folder);
2929
}
30+
31+
static string? mLogFilePath = null;
3032
}

TuneLab/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Program
2525
public static void Main(string[] args)
2626
{
2727
// init logger
28-
Log.SetupLogger(new FileLogger(Path.Combine(PathManager.LogsFolder, "TuneLab_" + DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss") + ".log")));
28+
Log.SetupLogger(new FileLogger(PathManager.LogFilePath));
2929
Log.Info("Version: " + AppInfo.Version);
3030

3131
// check if other instance is running

TuneLab/Resources/Translations/zh-CN.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
"TuneLab Forum" = "TuneLab 社区"
160160
"TuneLab GitHub" = "TuneLab 项目仓库"
161161
"Open TuneLab Folder" = "打开 TuneLab 文件夹"
162+
"Open Log" = "打开日志"
162163

163164
"Empty" = ""
164165
"Check for Updates..." = "检查更新..."

TuneLab/UI/MainWindow/Editor/Editor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,10 @@ Menu CreateMenu()
936936
var menuItem = new MenuItem().SetTrName("Open TuneLab Folder").SetAction(() => ProcessHelper.OpenUrl(PathManager.TuneLabFolder));
937937
menuBarItem.Items.Add(menuItem);
938938
}
939+
{
940+
var menuItem = new MenuItem().SetTrName("Open Log").SetAction(() => ProcessHelper.OpenUrl(PathManager.LogFilePath));
941+
menuBarItem.Items.Add(menuItem);
942+
}
939943
{
940944
var menuItem = new MenuItem().SetTrName("Check for Updates...").SetAction(() => CheckUpdate(false));
941945
menuBarItem.Items.Add(menuItem);

0 commit comments

Comments
 (0)