ExtensionsLogLevel.cs•1.46 kB
/*
┌──────────────────────────────────────────────────────────────────┐
│ Author: Ivan Murzak (https://github.com/IvanMurzak) │
│ Repository: GitHub (https://github.com/IvanMurzak/Unity-MCP) │
│ Copyright (c) 2025 Ivan Murzak │
│ Licensed under the Apache License, Version 2.0. │
│ See the LICENSE file in the project root for more information. │
└──────────────────────────────────────────────────────────────────┘
*/
#nullable enable
using Microsoft.Extensions.Logging;
namespace com.IvanMurzak.Unity.MCP.Runtime.Extensions
{
public static class ExtensionsLogLevel
{
public static bool IsEnabled(this LogLevel logLevel, LogLevel targetLogLevel)
=> logLevel <= targetLogLevel;
public static string ToString(this LogLevel logLevel) => logLevel switch
{
LogLevel.Trace => "Trace",
LogLevel.Debug => "Debug",
LogLevel.Information => "Information",
LogLevel.Warning => "Warning",
LogLevel.Error => "Error",
LogLevel.Critical => "Critical",
_ => "None"
};
}
}