mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-26 03:11:56 +01:00
Add exception message to logging when mapping fails due to an exception. (#1248)
* Add exception message to logging when mapping fails due to an exception.
* Revert "Add exception message to logging when mapping fails due to an exception."
This reverts commit eb7cf46c95.
* Fix loggers with improved exception logging.
This commit is contained in:
@@ -52,9 +52,9 @@ public class WireMockService : IWireMockService
|
|||||||
_logger.LogDebug("Admin[{0}] {1}", isAdminrequest, message);
|
_logger.LogDebug("Admin[{0}] {1}", isAdminrequest, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Error(string formatString, Exception exception)
|
public void Error(string message, Exception exception)
|
||||||
{
|
{
|
||||||
_logger.LogError(formatString, exception.Message);
|
_logger.LogError(exception, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ public sealed class TUnitWireMockLogger : IWireMockLogger
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Error(string formatString, Exception exception)
|
public void Error(string message, Exception exception)
|
||||||
{
|
{
|
||||||
_tUnitLogger.LogError(Format("Error", formatString, exception.Message), exception);
|
_tUnitLogger.LogError(Format("Error", $"{message} {{0}}", exception));
|
||||||
|
|
||||||
if (exception is AggregateException ae)
|
if (exception is AggregateException ae)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,15 +50,15 @@ public sealed class TestOutputHelperWireMockLogger : IWireMockLogger
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Error(string formatString, Exception exception)
|
public void Error(string message, Exception exception)
|
||||||
{
|
{
|
||||||
_testOutputHelper.WriteLine(Format("Error", formatString, exception.Message));
|
_testOutputHelper.WriteLine(Format("Error", $"{message} {{0}}", exception));
|
||||||
|
|
||||||
if (exception is AggregateException ae)
|
if (exception is AggregateException ae)
|
||||||
{
|
{
|
||||||
ae.Handle(ex =>
|
ae.Handle(ex =>
|
||||||
{
|
{
|
||||||
_testOutputHelper.WriteLine(Format("Error", "Exception {0}", ex.Message));
|
_testOutputHelper.WriteLine(Format("Error", "Exception {0}", ex));
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user