From 6d0f347979d7aaaf79ee828ba503d48d4b57bfc3 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sat, 26 Aug 2017 00:07:07 -0700 Subject: [PATCH] [Logger] Add params overrides --- SabreTools.Library/Logger.cs | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/SabreTools.Library/Logger.cs b/SabreTools.Library/Logger.cs index 7a0142c0..3e6f53cb 100644 --- a/SabreTools.Library/Logger.cs +++ b/SabreTools.Library/Logger.cs @@ -250,6 +250,17 @@ namespace SabreTools.Library return Log(output, LogLevel.VERBOSE, appendPrefix); } + /// + /// Write the given string as a verbose message to the log output + /// + /// String to be written log + /// Optional arguments for string formatting + /// True if the output could be written, false otherwises + public bool Verbose(string output, params object[] args) + { + return Log(string.Format(output, args), LogLevel.VERBOSE, true); + } + /// /// Write the given string as a user message to the log output /// @@ -261,6 +272,17 @@ namespace SabreTools.Library return Log(output, LogLevel.USER, appendPrefix); } + /// + /// Write the given string as a user message to the log output + /// + /// String to be written log + /// Optional arguments for string formatting + /// True if the output could be written, false otherwise + public bool User(string output, params object[] args) + { + return Log(string.Format(output, args), LogLevel.USER, true); + } + /// /// Write the given string as a warning to the log output /// @@ -273,6 +295,18 @@ namespace SabreTools.Library return Log(output, LogLevel.WARNING, appendPrefix); } + /// + /// Write the given string as a warning to the log output + /// + /// String to be written log + /// Optional arguments for string formatting + /// True if the output could be written, false otherwise + public bool Warning(string output, params object[] args) + { + _warnings = true; + return Log(string.Format(output, args), LogLevel.WARNING, true); + } + /// /// Writes the given string as an error in the log /// @@ -285,6 +319,18 @@ namespace SabreTools.Library return Log(output, LogLevel.ERROR, appendPrefix); } + /// + /// Writes the given string as an error in the log + /// + /// String to be written log + /// Optional arguments for string formatting + /// True if the output could be written, false otherwise + public bool Error(string output, params object[] args) + { + _errors = true; + return Log(string.Format(output, args), LogLevel.ERROR, true); + } + /// /// Clear lines beneath the given line in the console ///