Explorar o código

Use specific log levels instead of defining a max verbosity
Rebase of fd474fdd8fc1df6a28c0408a27fe96e6081ae39e

Bepis %!s(int64=4) %!d(string=hai) anos
pai
achega
265f484447

+ 2 - 2
BepInEx.Core/Bootstrap/BaseChainloader.cs

@@ -339,8 +339,8 @@ namespace BepInEx.Bootstrap
 
 		private static readonly ConfigEntry<LogLevel> ConfigDiskConsoleDisplayedLevel = ConfigFile.CoreConfig.Bind(
 			"Logging.Disk", "DisplayedLogLevel",
-			LogLevel.Info,
-			"Only displays the specified log level and above in the console output.");
+			LogLevel.Fatal | LogLevel.Error | LogLevel.Message | LogLevel.Info,
+			"Only displays the specified log levels in the disk log output.");
 
 		#endregion
 	}

+ 3 - 3
BepInEx.Core/Logging/ConsoleLogListener.cs

@@ -10,7 +10,7 @@ namespace BepInEx.Logging
 	{
 		public void LogEvent(object sender, LogEventArgs eventArgs)
 		{
-			if (eventArgs.Level.GetHighestLevel() > ConfigConsoleDisplayedLevel.Value)
+			if ((eventArgs.Level & ConfigConsoleDisplayedLevel.Value) > 0)
 				return;
 
 			string log = $"[{eventArgs.Level,-7}:{((ILogSource)sender).SourceName,10}] {eventArgs.Data}\r\n";
@@ -24,7 +24,7 @@ namespace BepInEx.Logging
 
 		private static readonly ConfigEntry<LogLevel> ConfigConsoleDisplayedLevel = ConfigFile.CoreConfig.Bind(
 			"Logging.Console","DisplayedLogLevel",
-			LogLevel.Info,
-			"Only displays the specified log level and above in the console output.");
+			LogLevel.Fatal | LogLevel.Error | LogLevel.Message | LogLevel.Info,
+			"Only displays the specified log levels in the console output.");
 	}
 }

+ 1 - 1
BepInEx.Core/Logging/DiskLogListener.cs

@@ -51,7 +51,7 @@ namespace BepInEx.Logging
 			if (BlacklistedSources.Contains(eventArgs.Source.SourceName))
 				return;
 
-			if (eventArgs.Level.GetHighestLevel() > DisplayedLogLevel)
+			if ((eventArgs.Level & DisplayedLogLevel) > 0)
 				return;
 
 			LogWriter.WriteLine($"[{eventArgs.Level,-7}:{((ILogSource)sender).SourceName,10}] {eventArgs.Data}");