mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-22 10:34:30 +08:00
- 移除原有的LoggerGenerator.cs和相关README文档 - 重命名GFramework.Generator为GFramework.SourceGenerators - 重命名GFramework.Generator.Attributes为GFramework.SourceGenerators.Attributes - 添加新的Godot日志生成器(GodotLoggerGenerator)及对应属性(GodotLogAttribute) - 创建GFramework.Godot.SourceGenerators新项目用于Godot特定功能 - 修改日志生成器使用GodotLoggerFactory而非ConsoleLoggerFactory
37 lines
1.3 KiB
C#
37 lines
1.3 KiB
C#
using Microsoft.CodeAnalysis;
|
||
|
||
namespace GFramework.SourceGenerators.logging;
|
||
|
||
/// <summary>
|
||
/// 提供诊断描述符的静态类,用于GFramework日志生成器的编译时检查
|
||
/// </summary>
|
||
internal static class LoggerDiagnostics
|
||
{
|
||
/// <summary>
|
||
/// 定义诊断描述符:要求使用[Log]特性的类必须声明为partial
|
||
/// </summary>
|
||
/// <remarks>
|
||
/// 当类使用[Log]特性但未声明为partial时,编译器将报告此错误
|
||
/// </remarks>
|
||
public static readonly DiagnosticDescriptor MustBePartial =
|
||
new(
|
||
id: "GFLOG001",
|
||
title: "Class must be partial",
|
||
messageFormat: "Class '{0}' must be declared partial to use [Log]",
|
||
category: "GFramework.Logging",
|
||
DiagnosticSeverity.Error,
|
||
isEnabledByDefault: true
|
||
);
|
||
|
||
/// <summary>
|
||
/// 定义诊断描述符:LogAttribute无法生成Logger的错误情况
|
||
/// </summary>
|
||
public static readonly DiagnosticDescriptor LogAttributeInvalid =
|
||
new(
|
||
id: "GFW_LOG001",
|
||
title: "LogAttribute cannot generate Logger",
|
||
messageFormat: "LogAttribute on class '{0}' is ineffective: {1}",
|
||
category: "GFramework.Godot.Logging",
|
||
DiagnosticSeverity.Warning,
|
||
isEnabledByDefault: true);
|
||
} |