mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Invert coupling from Core to Logging
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SabreTools.Logging;
|
||||
|
||||
namespace SabreTools.Core.Tools
|
||||
{
|
||||
@@ -8,6 +9,23 @@ namespace SabreTools.Core.Tools
|
||||
{
|
||||
#region String to Enum
|
||||
|
||||
/// <summary>
|
||||
/// Get the LogLevel value for an input string, if possible
|
||||
/// </summary>
|
||||
/// <param name="value">String value to parse/param>
|
||||
/// <returns></returns>
|
||||
public static LogLevel AsLogLevel(this string? value)
|
||||
{
|
||||
return value?.ToLowerInvariant() switch
|
||||
{
|
||||
"verbose" => LogLevel.VERBOSE,
|
||||
"user" => LogLevel.USER,
|
||||
"warning" => LogLevel.WARNING,
|
||||
"error" => LogLevel.ERROR,
|
||||
_ => LogLevel.VERBOSE,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get bool? value from input string
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user