SafeDispatch/SafeMobileLIB_DLL/Logs/LogLevel.cs

51 lines
1.4 KiB
C#
Raw Normal View History

2024-02-22 16:43:59 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SafeMobileLib.Logs
{
public sealed class LogLevel
{
private readonly String name;
private readonly int value;
public static readonly LogLevel Minimal = new LogLevel(1, "minimal");
public static readonly LogLevel Critical = new LogLevel(2, "critical");
public static readonly LogLevel Verbose = new LogLevel(3, "verbose");
private LogLevel(int value, String name)
{
this.name = name;
this.value = value;
}
public override String ToString()
{
return name;
}
/// <summary>
/// Get the direction from a string representation of it
/// </summary>
/// <param name="logLevel">String containing the log level name</param>
/// <returns>Direction object </returns>
public static LogLevel GetLogLevel(String logLevel)
{
if (logLevel.ToLower().Trim().Equals(Critical.ToString().ToLower()))
return Critical;
if (logLevel.ToLower().Trim().Equals(Minimal.ToString().ToLower()))
return Minimal;
if (logLevel.ToLower().Trim().Equals(Verbose.ToString().ToLower()))
return Verbose;
return Verbose;
}
}
}