mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-25 21:34:28 +08:00
fix(logging): 修复GodotLogger生成器中的工厂实例化问题
- 修复GodotLoggerGenerator中GodotLoggerFactory的实例化方式, 从静态方法调用改为实例方法调用 - 将默认日志字段名从"_log"更改为"Logger", 以提供更具描述性的命名
This commit is contained in:
parent
b5c1371b86
commit
4fbc067414
@ -29,7 +29,7 @@ public sealed class GodotLogAttribute : Attribute
|
|||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
/// <summary>生成字段名</summary>
|
/// <summary>生成字段名</summary>
|
||||||
public string FieldName { get; set; } = "_log";
|
public string FieldName { get; set; } = "Logger";
|
||||||
|
|
||||||
/// <summary>是否生成 static 字段</summary>
|
/// <summary>是否生成 static 字段</summary>
|
||||||
public bool IsStatic { get; set; } = true;
|
public bool IsStatic { get; set; } = true;
|
||||||
|
|||||||
@ -161,7 +161,7 @@ public sealed class GodotLoggerGenerator : IIncrementalGenerator
|
|||||||
sb.AppendLine(" /// <summary>Auto-generated logger</summary>");
|
sb.AppendLine(" /// <summary>Auto-generated logger</summary>");
|
||||||
sb.AppendLine(
|
sb.AppendLine(
|
||||||
$" {access} {staticKeyword}readonly ILogger {fieldName} = " +
|
$" {access} {staticKeyword}readonly ILogger {fieldName} = " +
|
||||||
$"new GodotLoggerFactory.GetLogger(\"{name}\");");
|
$"new GodotLoggerFactory().GetLogger(\"{name}\");");
|
||||||
sb.AppendLine(" }");
|
sb.AppendLine(" }");
|
||||||
|
|
||||||
if (ns is not null)
|
if (ns is not null)
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public sealed class LogAttribute : Attribute
|
|||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
/// <summary>生成字段名</summary>
|
/// <summary>生成字段名</summary>
|
||||||
public string FieldName { get; set; } = "_log";
|
public string FieldName { get; set; } = "Logger";
|
||||||
|
|
||||||
/// <summary>是否生成 static 字段</summary>
|
/// <summary>是否生成 static 字段</summary>
|
||||||
public bool IsStatic { get; set; } = true;
|
public bool IsStatic { get; set; } = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user