GwWuYou 763b460575 refactor(GFramework.Generator): 重构代码生成器结构并添加Godot日志生成器
- 移除原有的LoggerGenerator.cs和相关README文档
- 重命名GFramework.Generator为GFramework.SourceGenerators
- 重命名GFramework.Generator.Attributes为GFramework.SourceGenerators.Attributes
- 添加新的Godot日志生成器(GodotLoggerGenerator)及对应属性(GodotLogAttribute)
- 创建GFramework.Godot.SourceGenerators新项目用于Godot特定功能
- 修改日志生成器使用GodotLoggerFactory而非ConsoleLoggerFactory
2025-12-25 21:10:29 +08:00

36 lines
1001 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#nullable enable
using System;
namespace GFramework.SourceGenerators.Attributes.logging;
/// <summary>
/// 标注在类上Source Generator 会为该类自动生成一个日志记录器字段。
/// </summary>
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class LogAttribute : Attribute
{
public LogAttribute()
{
}
/// <summary>
/// 初始化 GodotLogAttribute 类的新实例
/// </summary>
/// <param name="name">日志分类名,默认使用类名</param>
public LogAttribute(string? name)
{
Name = name;
}
/// <summary>日志分类名(默认使用类名)</summary>
public string? Name { get; set; }
/// <summary>生成字段名</summary>
public string FieldName { get; set; } = "_log";
/// <summary>是否生成 static 字段</summary>
public bool IsStatic { get; set; } = true;
/// <summary>访问修饰符</summary>
public string AccessModifier { get; set; } = "private";
}