From 6f40c66b310eff0830d60b018e3b0cae46d6fee4 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 23 Feb 2021 18:10:40 +0100 Subject: [PATCH] Add WarningOnce, ErrorOnce, InfoOnce, VerboseOnce to Flax.Build logger --- Source/Tools/Flax.Build/Log.cs | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Source/Tools/Flax.Build/Log.cs b/Source/Tools/Flax.Build/Log.cs index ba948d7ca..1687705ce 100644 --- a/Source/Tools/Flax.Build/Log.cs +++ b/Source/Tools/Flax.Build/Log.cs @@ -123,6 +123,58 @@ namespace Flax.Build Write(message, ConsoleColor.Red, true); } + /// + /// Logs the verbose message. + /// + /// The message. + /// The flag used to indicate whether this log was already sent. + public static void VerboseOnce(string message, ref bool flag) + { + if (flag) + return; + flag = true; + Write(message, _defaultColor, Configuration.ConsoleLog && Configuration.Verbose); + } + + /// + /// Logs the information. + /// + /// The message. + /// The flag used to indicate whether this log was already sent. + public static void InfoOnce(string message, ref bool flag) + { + if (flag) + return; + flag = true; + Write(message, _defaultColor, Configuration.ConsoleLog); + } + + /// + /// Logs the warning message. + /// + /// The message. + /// The flag used to indicate whether this log was already sent. + public static void WarningOnce(string message, ref bool flag) + { + if (flag) + return; + flag = true; + Write(message, ConsoleColor.Yellow, true); + } + + /// + /// Logs the error message. + /// + /// The message. + /// The flag used to indicate whether this log was already sent. + public static void ErrorOnce(string message, ref bool flag) + { + if (flag) + return; + flag = true; + Write(message, ConsoleColor.Red, true); + } + /// /// Logs the exception. ///