From add9cf157d877a61bc2682818a227c3738b43470 Mon Sep 17 00:00:00 2001 From: ww-rm Date: Wed, 29 Oct 2025 20:54:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8E=8B=E7=BC=A9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dotnet-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-release.yml b/.github/workflows/dotnet-release.yml index e1b66cd..6b458c6 100644 --- a/.github/workflows/dotnet-release.yml +++ b/.github/workflows/dotnet-release.yml @@ -126,7 +126,8 @@ jobs: - name: Compress Linux build run: | mkdir -p release - zip -r "release/${PROJ_CLI_NAME}-${VERSION}-Linux-SelfContained.zip" "publish/${PROJ_CLI_NAME}-${VERSION}-Linux-SelfContained" + cd publish + zip -r "../release/${PROJ_CLI_NAME}-${VERSION}-Linux-SelfContained.zip" "${PROJ_CLI_NAME}-${VERSION}-Linux-SelfContained" - name: Upload Linux zip to GitHub Release uses: actions/upload-release-asset@v1 From 332019a667aef334cf3cee6f8155349c35b32d62 Mon Sep 17 00:00:00 2001 From: ww-rm Date: Wed, 29 Oct 2025 21:00:38 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E6=97=A0=E6=B3=95=E8=87=AA=E5=8A=A8=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpineViewer/App.xaml.cs | 1 + SpineViewerCLI/SpineViewerCLI.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/SpineViewer/App.xaml.cs b/SpineViewer/App.xaml.cs index af068ba..32b1040 100644 --- a/SpineViewer/App.xaml.cs +++ b/SpineViewer/App.xaml.cs @@ -86,6 +86,7 @@ namespace SpineViewer Encoding = System.Text.Encoding.UTF8, Layout = "${date:format=yyyy-MM-dd HH\\:mm\\:ss} - ${level:uppercase=true} - ${processid} - ${callsite-filename:includeSourcePath=false}:${callsite-linenumber} - ${message}", AutoFlush = true, + CreateDirs = true, FileName = "${basedir}/logs/app.log", ArchiveFileName = "${basedir}/logs/app.{#}.log", ArchiveNumbering = NLog.Targets.ArchiveNumberingMode.Rolling, diff --git a/SpineViewerCLI/SpineViewerCLI.cs b/SpineViewerCLI/SpineViewerCLI.cs index 8615ad9..cfd845a 100644 --- a/SpineViewerCLI/SpineViewerCLI.cs +++ b/SpineViewerCLI/SpineViewerCLI.cs @@ -44,6 +44,7 @@ namespace SpineViewerCLI Encoding = System.Text.Encoding.UTF8, Layout = "${date:format=yyyy-MM-dd HH\\:mm\\:ss} - ${level:uppercase=true} - ${processid} - ${callsite-filename:includeSourcePath=false}:${callsite-linenumber} - ${message}", AutoFlush = true, + CreateDirs = true, FileName = "${basedir}/logs/cli.log", ArchiveFileName = "${basedir}/logs/cli.{#}.log", ArchiveNumbering = NLog.Targets.ArchiveNumberingMode.Rolling, From b3ba073368480eaebca8162a36272ea6ceaad368 Mon Sep 17 00:00:00 2001 From: ww-rm Date: Wed, 29 Oct 2025 21:34:30 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SpineViewerCLI/SpineViewerCLI.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/SpineViewerCLI/SpineViewerCLI.cs b/SpineViewerCLI/SpineViewerCLI.cs index cfd845a..9bcbea3 100644 --- a/SpineViewerCLI/SpineViewerCLI.cs +++ b/SpineViewerCLI/SpineViewerCLI.cs @@ -5,11 +5,14 @@ using Spine; using Spine.Exporters; using System.CommandLine; using System.Globalization; +using System.Runtime.InteropServices; namespace SpineViewerCLI { public static class SpineViewerCLI { + private static readonly Logger _logger = LogManager.GetCurrentClassLogger(); + public static Option OptQuiet { get; } = new("--quiet", "-q") { Description = "Suppress console logging (quiet mode).", @@ -33,11 +36,21 @@ namespace SpineViewerCLI if (!result.GetValue(OptQuiet)) InitializeConsoleLog(); - return result.Invoke(); + try + { + return result.Invoke(); + } + catch (Exception ex) + { + _logger.Trace(ex.ToString()); + _logger.Fatal("Failed to execute, {0}", ex.Message); + return -1; + } } private static void InitializeFileLog() { + // XXX: 未知原因 linux 平台上无法正常生成日志文件 var config = new NLog.Config.LoggingConfiguration(); var fileTarget = new NLog.Targets.FileTarget("fileTarget") { @@ -72,13 +85,15 @@ namespace SpineViewerCLI DetectOutputRedirected = true, }; + consoleTarget.RowHighlightingRules.Add(new("level == LogLevel.Trace", NLog.Targets.ConsoleOutputColor.DarkGray, NLog.Targets.ConsoleOutputColor.NoChange)); + consoleTarget.RowHighlightingRules.Add(new("level == LogLevel.Debug", NLog.Targets.ConsoleOutputColor.DarkGray, NLog.Targets.ConsoleOutputColor.NoChange)); consoleTarget.RowHighlightingRules.Add(new("level == LogLevel.Info", NLog.Targets.ConsoleOutputColor.DarkGray, NLog.Targets.ConsoleOutputColor.NoChange)); consoleTarget.RowHighlightingRules.Add(new("level == LogLevel.Warn", NLog.Targets.ConsoleOutputColor.DarkYellow, NLog.Targets.ConsoleOutputColor.NoChange)); consoleTarget.RowHighlightingRules.Add(new("level == LogLevel.Error", NLog.Targets.ConsoleOutputColor.Red, NLog.Targets.ConsoleOutputColor.NoChange)); consoleTarget.RowHighlightingRules.Add(new("level == LogLevel.Fatal", NLog.Targets.ConsoleOutputColor.White, NLog.Targets.ConsoleOutputColor.DarkRed)); config.AddTarget(consoleTarget); - config.AddRule(LogLevel.Info, LogLevel.Fatal, consoleTarget); + config.AddRule(LogLevel.Trace, LogLevel.Fatal, consoleTarget); LogManager.Configuration = config; } }