mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-23 03:04:29 +08:00
- 修复GodotLoggerGenerator中GodotLoggerFactory的实例化方式, 从静态方法调用改为实例方法调用 - 将默认日志字段名从"_log"更改为"Logger", 以提供更具描述性的命名
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
#nullable enable
|
||
using System;
|
||
|
||
namespace GFramework.Godot.SourceGenerators.Attributes.logging;
|
||
|
||
/// <summary>
|
||
/// Godot日志特性,用于在类上标记以自动生成日志字段
|
||
/// </summary>
|
||
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
|
||
public sealed class GodotLogAttribute : Attribute
|
||
{
|
||
/// <summary>
|
||
/// 初始化 GodotLogAttribute 类的新实例
|
||
/// </summary>
|
||
public GodotLogAttribute()
|
||
{
|
||
}
|
||
|
||
/// <summary>
|
||
/// 初始化 GodotLogAttribute 类的新实例
|
||
/// </summary>
|
||
/// <param name="name">日志分类名</param>
|
||
public GodotLogAttribute(string? name)
|
||
{
|
||
Name = name;
|
||
}
|
||
|
||
/// <summary>日志分类名(默认使用类名)</summary>
|
||
public string? Name { get; set; }
|
||
|
||
/// <summary>生成字段名</summary>
|
||
public string FieldName { get; set; } = "Logger";
|
||
|
||
/// <summary>是否生成 static 字段</summary>
|
||
public bool IsStatic { get; set; } = true;
|
||
|
||
/// <summary>访问修饰符</summary>
|
||
public string AccessModifier { get; set; } = "private";
|
||
} |