diff --git a/src/WireMock.Net.Abstractions/Logging/IWireMockLogger.cs b/src/WireMock.Net.Abstractions/Logging/IWireMockLogger.cs index c68ce26d..c8d5a3d9 100644 --- a/src/WireMock.Net.Abstractions/Logging/IWireMockLogger.cs +++ b/src/WireMock.Net.Abstractions/Logging/IWireMockLogger.cs @@ -51,10 +51,10 @@ public interface IWireMockLogger /// /// Writes the message at the Error level using the specified exception. /// - /// The format string. + /// The message. /// The exception. [PublicAPI] - void Error(string formatString, Exception exception); + void Error(string message, Exception exception); /// /// Writes the LogEntryModel (LogRequestModel, LogResponseModel and more). diff --git a/src/WireMock.Net/Logging/WireMockConsoleLogger.cs b/src/WireMock.Net/Logging/WireMockConsoleLogger.cs index 37b6b3ce..092e54e3 100644 --- a/src/WireMock.Net/Logging/WireMockConsoleLogger.cs +++ b/src/WireMock.Net/Logging/WireMockConsoleLogger.cs @@ -52,9 +52,9 @@ public void Error(string formatString, params object[] args) } /// - public void Error(string formatString, Exception exception) + public void Error(string message, Exception exception) { - Console.WriteLine(Format("Error", formatString, exception.Message)); + Console.WriteLine(Format("Error", $"{message} {{0}}", exception.Message)); if (exception is AggregateException ae) { diff --git a/src/WireMock.Net/Logging/WireMockNullLogger.cs b/src/WireMock.Net/Logging/WireMockNullLogger.cs index 3db1d186..148d7d95 100644 --- a/src/WireMock.Net/Logging/WireMockNullLogger.cs +++ b/src/WireMock.Net/Logging/WireMockNullLogger.cs @@ -36,7 +36,7 @@ public void Error(string formatString, params object[] args) } /// - public void Error(string formatString, Exception exception) + public void Error(string message, Exception exception) { // Log nothing } diff --git a/src/WireMock.Net/Server/WireMockServer.Admin.cs b/src/WireMock.Net/Server/WireMockServer.Admin.cs index a7cf33ca..8f39a9a7 100644 --- a/src/WireMock.Net/Server/WireMockServer.Admin.cs +++ b/src/WireMock.Net/Server/WireMockServer.Admin.cs @@ -178,9 +178,9 @@ public void ReadStaticMappings(string? folder = null) { ReadStaticMappingAndAddOrUpdate(filename); } - catch + catch (Exception exception) { - _settings.Logger.Error("Static MappingFile : '{0}' could not be read. This file will be skipped.", filename); + _settings.Logger.Error($"Static MappingFile : '{filename}' could not be read. This file will be skipped.", exception); } } }