mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 移除原有的LoggerGenerator.cs和相关README文档 - 重命名GFramework.Generator为GFramework.SourceGenerators - 重命名GFramework.Generator.Attributes为GFramework.SourceGenerators.Attributes - 添加新的Godot日志生成器(GodotLoggerGenerator)及对应属性(GodotLogAttribute) - 创建GFramework.Godot.SourceGenerators新项目用于Godot特定功能 - 修改日志生成器使用GodotLoggerFactory而非ConsoleLoggerFactory
36 lines
1001 B
C#
36 lines
1001 B
C#
#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";
|
||
} |