Skip to content

Commit

Permalink
setttings log level mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
kaqq authored Dec 31, 2019
1 parent b506ac5 commit 5f5ef35
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions src/Logbert/Logging/LogMessageLog4Net.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,22 +325,29 @@ private bool ParseData(string data)
/// <returns>The mapped <see cref="LogLevel"/>.</returns>
private LogLevel MapLevelType(string levelType)
{
if (!string.IsNullOrEmpty(levelType))
if (!string.IsNullOrEmpty(levelType))
{
switch (levelType.ToUpper())
var level = levelType;
if (Settings.Default.LevelTRACE.Split(';').Any(x=>String.Equals(x,level,StringComparison.CurrentCultureIgnoreCase)))
{
case "TRACE":
return LogLevel.Trace;
case "DEBUG":
return LogLevel.Debug;
case "INFO":
return LogLevel.Info;
case "WARN":
return LogLevel.Warning;
case "ERROR":
return LogLevel.Error;
case "FATAL":
return LogLevel.Fatal;
return LogLevel.Trace;
}
else if (Settings.Default.LevelDEBUG.Split(';').Any(x => String.Equals(x, level, StringComparison.CurrentCultureIgnoreCase)))

{
return LogLevel.Debug;
}
else if (Settings.Default.LevelINFO.Split(';').Any(x => String.Equals(x, level, StringComparison.CurrentCultureIgnoreCase)))
{
return LogLevel.Info;
}
else if (Settings.Default.LevelWARN.Split(';').Any(x => String.Equals(x, level, StringComparison.CurrentCultureIgnoreCase)))
{
return LogLevel.Warning;
}
else if (Settings.Default.LevelFATAL.Split(';').Any(x => String.Equals(x, level, StringComparison.CurrentCultureIgnoreCase)))
{
return LogLevel.Fatal;
}
}

Expand Down

0 comments on commit 5f5ef35

Please sign in to comment.