From 378690a42c8ebc3a01f9695da8edc04663c47e8e Mon Sep 17 00:00:00 2001 From: GwWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Thu, 25 Dec 2025 22:09:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(logging):=20=E4=BF=AE=E5=A4=8D=E6=BA=90?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E5=99=A8=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E5=B1=9E=E6=80=A7=E5=BC=95=E7=94=A8=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正 GodotLoggerGenerator 中的属性元数据名称为正确的命名空间路径 - 更新 LoggerGenerator 中的属性引用从 GodotLogAttribute 改为 LogAttribute - 修复 ConsoleLoggerFactory 的实例化方式,添加缺失的构造函数调用 - 统一日志属性名称格式,移除多余的 Godot 前缀 --- .../logging/GodotLoggerGenerator.cs | 6 ++++-- GFramework.SourceGenerators/logging/LoggerGenerator.cs | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs b/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs index 35f4c10..b4b5cab 100644 --- a/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs +++ b/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs @@ -14,9 +14,11 @@ namespace GFramework.Godot.SourceGenerators.logging; [Generator] public sealed class GodotLoggerGenerator : IIncrementalGenerator { - private const string AttributeMetadataName = "GFramework.SourceGenerators.Attributes.logging.GodotLogAttribute"; + private const string AttributeMetadataName = + "GFramework.Godot.SourceGenerators.Attributes.logging.GodotLogAttribute"; + private const string AttributeShortName = "GodotLogAttribute"; - private const string AttributeShortNameWithoutSuffix = "Log"; + private const string AttributeShortNameWithoutSuffix = "GodotLog"; /// /// 初始化生成器,设置语法过滤和代码生成逻辑 diff --git a/GFramework.SourceGenerators/logging/LoggerGenerator.cs b/GFramework.SourceGenerators/logging/LoggerGenerator.cs index d71f4c3..20a0bcd 100644 --- a/GFramework.SourceGenerators/logging/LoggerGenerator.cs +++ b/GFramework.SourceGenerators/logging/LoggerGenerator.cs @@ -17,8 +17,8 @@ namespace GFramework.SourceGenerators.logging; [Generator] public sealed class LoggerGenerator : IIncrementalGenerator { - private const string AttributeMetadataName = "GFramework.SourceGenerators.Attributes.logging.GodotLogAttribute"; - private const string AttributeShortName = "GodotLogAttribute"; + private const string AttributeMetadataName = "GFramework.SourceGenerators.Attributes.logging.LogAttribute"; + private const string AttributeShortName = "LogAttribute"; private const string AttributeShortNameWithoutSuffix = "Log"; /// @@ -163,7 +163,7 @@ public sealed class LoggerGenerator : IIncrementalGenerator sb.AppendLine($" /// Auto-generated logger"); sb.AppendLine( $" {access} {staticKeyword}readonly ILogger {fieldName} = " + - $"new ConsoleLoggerFactory.GetLogger(\"{name}\");"); + $"new ConsoleLoggerFactory().GetLogger(\"{name}\");"); sb.AppendLine(" }"); if (ns is not null)