mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 19:03:29 +08:00
- 将TargetFramework从net10.0更改为netstandard2.0以提高兼容性 - 添加必要的using语句(System和System.Linq)到GodotLoggerGenerator - 配置项目属性以支持Roslyn分析器功能,包括GeneratePackageOnBuild、 IsRoslynAnalyzer等设置 - 添加EnforceExtendedAnalyzerRules以启用扩展规则验证 - 配置项目引用GFramework.Godot.SourceGenerators.Attributes并设置 PrivateAssets="all"避免运行时依赖 - 设置打包配置将生成器DLL打包为analyzers/dotnet/cs路径 - 修正GodotLogAttribute命名空间为GFramework.Godot.SourceGenerators.Attributes.logging - 更新PackageId为GeWuYou.GFramework.SourceGenerators.Attributes - 移除不必要的PackageReadmeFile配置
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; } = "_log";
|
||
|
||
/// <summary>是否生成 static 字段</summary>
|
||
public bool IsStatic { get; set; } = true;
|
||
|
||
/// <summary>访问修饰符</summary>
|
||
public string AccessModifier { get; set; } = "private";
|
||
} |