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

44 lines
1.4 KiB
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.

using Microsoft.CodeAnalysis;
namespace GFramework.Godot.SourceGenerators.logging;
/// <summary>
/// 提供诊断描述符的静态类用于GFramework日志生成器的编译时检查
/// </summary>
internal static class GodotLoggerDiagnostics
{
/// <summary>
/// 诊断描述符:标识使用[GodotLog]特性的类必须声明为partial
/// </summary>
/// <remarks>
/// ID: GFLOG001
/// 严重性: Error
/// 分类: GFramework.Godot.Logging
/// </remarks>
public static readonly DiagnosticDescriptor MustBePartial =
new(
id: "GFLOG001",
title: "Class must be partial",
messageFormat: "Class '{0}' must be declared as partial to use [GodotLog]",
category: "GFramework.Godot.Logging",
DiagnosticSeverity.Error,
isEnabledByDefault: true
);
/// <summary>
/// 诊断描述符标识GodotLogAttribute无法在指定类上生成Logger
/// </summary>
/// <remarks>
/// ID: GFW_LOG001
/// 严重性: Warning
/// 分类: GFramework.Godot.Logging
/// </remarks>
public static readonly DiagnosticDescriptor LogAttributeInvalid = new(
id: "GFW_LOG001",
title: "GodotLogAttribute cannot generate Logger",
messageFormat: "GodotLogAttribute on class '{0}' is ineffective: {1}",
category: "GFramework.Godot.Logging",
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
}