From f2d9afd788ceb82fc20f68ebc2b47add04a52566 Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Tue, 10 May 2016 00:35:59 -0500 Subject: [PATCH] Added support for boolean log levels --- Source/Shared/Logging/LogLevel.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Source/Shared/Logging/LogLevel.cs b/Source/Shared/Logging/LogLevel.cs index 6bd1aec2..a44ff0b5 100644 --- a/Source/Shared/Logging/LogLevel.cs +++ b/Source/Shared/Logging/LogLevel.cs @@ -115,7 +115,10 @@ public static LogLevel FromOrdinal(int ordinal) { public static LogLevel FromString(string levelName) { if (levelName == null) throw new ArgumentNullException("levelName"); - if (levelName.Equals("Trace", StringComparison.OrdinalIgnoreCase)) + if (levelName.Equals("Trace", StringComparison.OrdinalIgnoreCase) + || levelName.Equals("true", StringComparison.OrdinalIgnoreCase) + || levelName.Equals("1", StringComparison.OrdinalIgnoreCase) + || levelName.Equals("yes", StringComparison.OrdinalIgnoreCase)) return LogLevel.Trace; if (levelName.Equals("Debug", StringComparison.OrdinalIgnoreCase)) return LogLevel.Debug; @@ -127,7 +130,10 @@ public static LogLevel FromString(string levelName) { return LogLevel.Error; if (levelName.Equals("Fatal", StringComparison.OrdinalIgnoreCase)) return LogLevel.Fatal; - if (levelName.Equals("Off", StringComparison.OrdinalIgnoreCase)) + if (levelName.Equals("Off", StringComparison.OrdinalIgnoreCase) + || levelName.Equals("false", StringComparison.OrdinalIgnoreCase) + || levelName.Equals("0", StringComparison.OrdinalIgnoreCase) + || levelName.Equals("no", StringComparison.OrdinalIgnoreCase)) return LogLevel.Off; return LogLevel.Other;