diff --git a/GFramework.Godot.SourceGenerators.Attributes/logging/GodotLogAttribute.cs b/GFramework.Godot.SourceGenerators.Attributes/logging/GodotLogAttribute.cs index 41a6bdd..704cf0c 100644 --- a/GFramework.Godot.SourceGenerators.Attributes/logging/GodotLogAttribute.cs +++ b/GFramework.Godot.SourceGenerators.Attributes/logging/GodotLogAttribute.cs @@ -29,7 +29,7 @@ public sealed class GodotLogAttribute : Attribute public string? Name { get; set; } /// 生成字段名 - public string FieldName { get; set; } = "_log"; + public string FieldName { get; set; } = "Logger"; /// 是否生成 static 字段 public bool IsStatic { get; set; } = true; diff --git a/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs b/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs index 3abd4e1..35f4c10 100644 --- a/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs +++ b/GFramework.Godot.SourceGenerators/logging/GodotLoggerGenerator.cs @@ -161,7 +161,7 @@ public sealed class GodotLoggerGenerator : IIncrementalGenerator sb.AppendLine(" /// Auto-generated logger"); sb.AppendLine( $" {access} {staticKeyword}readonly ILogger {fieldName} = " + - $"new GodotLoggerFactory.GetLogger(\"{name}\");"); + $"new GodotLoggerFactory().GetLogger(\"{name}\");"); sb.AppendLine(" }"); if (ns is not null) diff --git a/GFramework.SourceGenerators.Attributes/logging/LogAttribute.cs b/GFramework.SourceGenerators.Attributes/logging/LogAttribute.cs index 0f2894e..aff9912 100644 --- a/GFramework.SourceGenerators.Attributes/logging/LogAttribute.cs +++ b/GFramework.SourceGenerators.Attributes/logging/LogAttribute.cs @@ -26,7 +26,7 @@ public sealed class LogAttribute : Attribute public string? Name { get; set; } /// 生成字段名 - public string FieldName { get; set; } = "_log"; + public string FieldName { get; set; } = "Logger"; /// 是否生成 static 字段 public bool IsStatic { get; set; } = true;