diff --git a/osu.Framework/Logging/LoadingComponentsLogger.cs b/osu.Framework/Logging/LoadingComponentsLogger.cs index 5b0d7deb00..86c3ba96ca 100644 --- a/osu.Framework/Logging/LoadingComponentsLogger.cs +++ b/osu.Framework/Logging/LoadingComponentsLogger.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Diagnostics; +using osu.Framework.Development; using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics; using osu.Framework.Lists; @@ -12,23 +12,26 @@ internal static class LoadingComponentsLogger { private static readonly WeakList loading_components = new WeakList(); - [Conditional("DEBUG")] public static void Add(Drawable component) { + if (!DebugUtils.IsDebugBuild) return; + lock (loading_components) loading_components.Add(component); } - [Conditional("DEBUG")] public static void Remove(Drawable component) { + if (!DebugUtils.IsDebugBuild) return; + lock (loading_components) loading_components.Remove(component); } - [Conditional("DEBUG")] public static void LogAndFlush() { + if (!DebugUtils.IsDebugBuild) return; + lock (loading_components) { Logger.Log("⏳ Currently loading components"); diff --git a/osu.Framework/Logging/Logger.cs b/osu.Framework/Logging/Logger.cs index c8d1698514..8b069d3ffc 100644 --- a/osu.Framework/Logging/Logger.cs +++ b/osu.Framework/Logging/Logger.cs @@ -3,13 +3,12 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Globalization; using System.IO; -using osu.Framework.Platform; using System.Linq; using System.Threading; using osu.Framework.Development; +using osu.Framework.Platform; using osu.Framework.Statistics; using osu.Framework.Threading; @@ -267,9 +266,11 @@ public static Logger GetLogger(string name) /// Logs a new message with the and will only be logged if your project is built in the Debug configuration. Please note that the default setting for is so unless you increase the to messages printed with this method will not appear in the output. /// /// The message that should be logged. - [Conditional("DEBUG")] public void Debug(string message = @"") { + if (!DebugUtils.IsDebugBuild) + return; + Add(message, LogLevel.Debug); }