// <auto-generated/>
#nullable enable
using Microsoft.Extensions.Logging;
namespace F0.Generated;
internal static class EnumInfo
{
public static string? ToString(LogLevel value, string? format)
{
if (String.IsNullOrEmpty(format))
{
return EnumInfo.GetName(value);
}
if (format.Length == 1)
{
if (format[0] is 'G' or 'g')
{
return EnumInfo.GetName(value);
}
if (format[0] is 'D' or 'd')
{
return value switch
{
LogLevel.Trace => "0",
LogLevel.Debug => "1",
LogLevel.Information => "2",
LogLevel.Warning => "3",
LogLevel.Error => "4",
LogLevel.Critical => "5",
LogLevel.None => "6",
_ => null,
};
}
if (format[0] is 'X' or 'x')
{
return value switch
{
LogLevel.Trace => "00000000",
LogLevel.Debug => "00000001",
LogLevel.Information => "00000002",
LogLevel.Warning => "00000003",
LogLevel.Error => "00000004",
LogLevel.Critical => "00000005",
LogLevel.None => "00000006",
_ => null,
};
}
if (format[0] is 'F' or 'f')
{
throw new NotSupportedException(@"Flags format is not supported.");
}
}
throw new FormatException(@"Format string can be only ""G"", ""g"", ""X"", ""x"", ""F"", ""f"", ""D"" or ""d"".");
}
}