diff --git a/src/Task/AggregateConfig.cs b/src/Task/AggregateConfig.cs index 0e9f9e1..7c133b8 100644 --- a/src/Task/AggregateConfig.cs +++ b/src/Task/AggregateConfig.cs @@ -97,7 +97,7 @@ public override bool Execute() if (!Enum.TryParse(OutputType, true, out FileType outputType) || !Enum.IsDefined(typeof(FileType), outputType)) { - logger.LogError("Invalid FileType: {0}. Available options: {1}", OutputType, string.Join(", ", Enum.GetNames(typeof(FileType)))); + logger.LogError(message: "Invalid FileType: {0}. Available options: {1}", OutputType, string.Join(", ", Enum.GetNames(typeof(FileType)))); return false; } @@ -105,7 +105,7 @@ public override bool Execute() if (!string.IsNullOrEmpty(InputType) && (!Enum.TryParse(InputType, true, out inputType) || !Enum.IsDefined(typeof(FileType), inputType))) { - logger.LogError("Invalid FileType: {0}. Available options: {1}", InputType, string.Join(", ", Enum.GetNames(typeof(FileType)))); + logger.LogError(message: "Invalid FileType: {0}. Available options: {1}", InputType, string.Join(", ", Enum.GetNames(typeof(FileType)))); return false; } @@ -121,7 +121,7 @@ public override bool Execute() if (finalResult == null) { - logger.LogError("No input was found! Check the input directory."); + logger.LogError(message: "No input was found! Check the input directory."); return false; } @@ -136,7 +136,7 @@ public override bool Execute() } catch (Exception ex) { - logger.LogError("An unknown exception occurred: {0}", ex.Message); + logger.LogError(message: "An unknown exception occurred: {0}", ex.Message); logger.LogErrorFromException(ex, true, true, null); return false; } diff --git a/src/Task/Logger/ITaskLogger.cs b/src/Task/Logger/ITaskLogger.cs index 733c19a..7333f78 100644 --- a/src/Task/Logger/ITaskLogger.cs +++ b/src/Task/Logger/ITaskLogger.cs @@ -16,31 +16,6 @@ public interface ITaskLogger /// Optional arguments for formatting the message. void LogError(string message = null, params object[] messageArgs); - /// - /// Logs an error message with additional parameters. - /// - /// The subcategory of the error. - /// The error code. - /// The help keyword associated with the error. - /// The file in which the error occurred. - /// The line number where the error occurred. - /// The column number where the error occurred. - /// The end line number of the error. - /// The end column number of the error. - /// The error message to log. - /// Optional arguments for formatting the message. - void LogError( - string subcategory = null, - string errorCode = null, - string helpKeyword = null, - string file = null, - int lineNumber = 0, - int columnNumber = 0, - int endLineNumber = 0, - int endColumnNumber = 0, - string message = null, - params object[] messageArgs); - /// /// Logs an error message from an exception. /// diff --git a/src/Task/Logger/QuietTaskLogger.cs b/src/Task/Logger/QuietTaskLogger.cs index b0b376f..af4b61b 100644 --- a/src/Task/Logger/QuietTaskLogger.cs +++ b/src/Task/Logger/QuietTaskLogger.cs @@ -24,35 +24,9 @@ public QuietTaskLogger(TaskLoggingHelper task) } /// - public void LogError(string message = null, params object[] messageArgs) + public void LogError(string message, params object[] messageArgs) { - Log.LogError(message, messageArgs); - } - - /// - public void LogError( - string subcategory = null, - string errorCode = null, - string helpKeyword = null, - string file = null, - int lineNumber = 0, - int columnNumber = 0, - int endLineNumber = 0, - int endColumnNumber = 0, - string message = null, - params object[] messageArgs) - { - Log.LogError( - subcategory, - errorCode, - helpKeyword, - file, - lineNumber, - columnNumber, - endLineNumber, - endColumnNumber, - message, - messageArgs); + Log.LogError(message ?? "Unknown Error", messageArgs); } /// diff --git a/src/Task/Logger/TaskLogger.cs b/src/Task/Logger/TaskLogger.cs index b3e4c6d..f0b5020 100644 --- a/src/Task/Logger/TaskLogger.cs +++ b/src/Task/Logger/TaskLogger.cs @@ -22,35 +22,9 @@ public TaskLogger(TaskLoggingHelper task) } /// - public void LogError(string message = null, params object[] messageArgs) + public void LogError(string message, params object[] messageArgs) { - Log.LogError(message, messageArgs); - } - - /// - public void LogError( - string subcategory = null, - string errorCode = null, - string helpKeyword = null, - string file = null, - int lineNumber = 0, - int columnNumber = 0, - int endLineNumber = 0, - int endColumnNumber = 0, - string message = null, - params object[] messageArgs) - { - Log.LogError( - subcategory, - errorCode, - helpKeyword, - file, - lineNumber, - columnNumber, - endLineNumber, - endColumnNumber, - message, - messageArgs); + Log.LogError(message ?? "Unknown Error", messageArgs); } /// diff --git a/src/Task/ObjectManager.cs b/src/Task/ObjectManager.cs index 5fb11cb..4ec2ac6 100644 --- a/src/Task/ObjectManager.cs +++ b/src/Task/ObjectManager.cs @@ -53,7 +53,7 @@ await fileGroups.ForEachAsync(Environment.ProcessorCount, catch (ArgumentException ex) { hasError = true; - log.LogError("No reader found for file {0}: {1} Stacktrace: {2}", file, ex.Message, ex.StackTrace); + log.LogError(message: "No reader found for file {0}: {1} Stacktrace: {2}", file, ex.Message, ex.StackTrace); continue; } @@ -65,7 +65,7 @@ await fileGroups.ForEachAsync(Environment.ProcessorCount, catch (Exception ex) { hasError = true; - log.LogError("Could not parse {0}: {1}", file, ex.Message); + log.LogError(message: "Could not parse {0}: {1}", file, ex.Message); log.LogErrorFromException(ex, true, true, file); continue; }