#10 Stop chronicle record message defaulting to exception message

parent 57ed468d
Pipeline #102 passed with stages
in 7 minutes and 9 seconds
......@@ -55,7 +55,7 @@ namespace KSharp.NChronicle.Core.Tests.ForChronicle
[TestMethod]
[DynamicData(nameof(_chronicleLevel))]
public void ThenTheMessageIsTheExceptionMessage(ChronicleLevel level)
public void ThenTheMessageIsNull(ChronicleLevel level)
{
Exception exception;
try
......@@ -72,7 +72,7 @@ namespace KSharp.NChronicle.Core.Tests.ForChronicle
// Assert
Assert.IsNotNull(this._receivedRecord, "No ChronicleRecord was received.");
Assert.AreEqual(exception.Message, this._receivedRecord.Message, "Message in received ChronicleRecord is not exception message.");
Assert.IsNull(this._receivedRecord.Message, "Message in received ChronicleRecord is not null.");
}
[TestMethod]
......
......@@ -54,7 +54,7 @@ namespace KSharp.NChronicle.Core.Tests.ForChronicle
[TestMethod]
[DynamicData(nameof(_chronicleLevel))]
public void ThenTheMessageIsTheExceptionMessage(ChronicleLevel level)
public void ThenTheMessageIsNull(ChronicleLevel level)
{
Exception exception;
try
......@@ -71,7 +71,7 @@ namespace KSharp.NChronicle.Core.Tests.ForChronicle
// Assert
Assert.IsNotNull(this._receivedRecord, "No ChronicleRecord was received.");
Assert.AreEqual(exception.Message, this._receivedRecord.Message, "Message in received ChronicleRecord is not exception message.");
Assert.IsNull(this._receivedRecord.Message, "Message in received ChronicleRecord is not null.");
}
[TestMethod]
......
......@@ -58,7 +58,7 @@ namespace KSharp.NChronicle.Core.Tests.ForChronicle
[TestMethod]
[DynamicData(nameof(_chronicleLevel))]
public void ThenTheMessageIsTheExceptionMessage(ChronicleLevel level)
public void ThenTheMessageIsNull(ChronicleLevel level)
{
Exception exception;
try
......@@ -75,7 +75,7 @@ namespace KSharp.NChronicle.Core.Tests.ForChronicle
// Assert
Assert.IsNotNull(this._receivedRecord, "No ChronicleRecord was received.");
Assert.AreEqual(exception.Message, this._receivedRecord.Message, "Message in received ChronicleRecord is not exception message.");
Assert.IsNull(this._receivedRecord.Message, "Message in received ChronicleRecord is not null.");
}
[TestMethod]
......
......@@ -57,7 +57,7 @@ namespace KSharp.NChronicle.Core.Tests.ForChronicle
[TestMethod]
[DynamicData(nameof(_chronicleLevel))]
public void ThenTheMessageIsTheExceptionMessage(ChronicleLevel level)
public void ThenTheMessageIsNull(ChronicleLevel level)
{
Exception exception;
try
......@@ -74,7 +74,7 @@ namespace KSharp.NChronicle.Core.Tests.ForChronicle
// Assert
Assert.IsNotNull(this._receivedRecord, "No ChronicleRecord was received.");
Assert.AreEqual(exception.Message, this._receivedRecord.Message, "Message in received ChronicleRecord is not exception message.");
Assert.IsNull(this._receivedRecord.Message, "Message in received ChronicleRecord is not null.");
}
[TestMethod]
......
......@@ -271,7 +271,7 @@ namespace KSharp.NChronicle.Core.Abstractions
private string MessageKeyHandler(ChronicleRecord record)
{
return record.Message != record.Exception?.Message ? record.Message : string.Empty;
return record.Message;
}
private string ExceptionKeyHandler(ChronicleRecord record)
......
......@@ -76,7 +76,7 @@ namespace KSharp.NChronicle.Core
/// <param name="tags">Tags to be appended to this record.</param>
public void Emergency(Exception exception, params string[] tags)
{
this.Emergency(exception.Message, exception, tags);
this.Emergency(null, exception, tags);
}
/// <summary>
......@@ -110,7 +110,7 @@ namespace KSharp.NChronicle.Core
/// <param name="tags">Tags to be appended to this record.</param>
public void Fatal(Exception exception, params string[] tags)
{
this.Fatal(exception.Message, exception, tags);
this.Fatal(null, exception, tags);
}
/// <summary>
......@@ -144,7 +144,7 @@ namespace KSharp.NChronicle.Core
/// <param name="tags">Tags to be appended to this record.</param>
public void Critical(Exception exception, params string[] tags)
{
this.Critical(exception.Message, exception, tags);
this.Critical(null, exception, tags);
}
/// <summary>
......@@ -178,7 +178,7 @@ namespace KSharp.NChronicle.Core
/// <param name="tags">Tags to be appended to this record.</param>
public void Warning(Exception exception, params string[] tags)
{
this.Warning(exception.Message, exception, tags);
this.Warning(null, exception, tags);
}
/// <summary>
......@@ -212,7 +212,7 @@ namespace KSharp.NChronicle.Core
/// <param name="tags">Tags to be appended to this record.</param>
public void Debug(Exception exception, params string[] tags)
{
this.Debug(exception.Message, exception, tags);
this.Debug(null, exception, tags);
}
/// <summary>
......@@ -246,7 +246,7 @@ namespace KSharp.NChronicle.Core
/// <param name="tags">Tags to be appended to this record.</param>
public void Success(Exception exception, params string[] tags)
{
this.Success(exception.Message, exception, tags);
this.Success(null, exception, tags);
}
/// <summary>
......@@ -280,7 +280,7 @@ namespace KSharp.NChronicle.Core
/// <param name="tags">Tags to be appended to this record.</param>
public void Info(Exception exception, params string[] tags)
{
this.Info(exception.Message, exception, tags);
this.Info(null, exception, tags);
}
/// <summary>
......@@ -314,7 +314,7 @@ namespace KSharp.NChronicle.Core
/// <param name="tags">Tags to be appended to this record.</param>
public void Trace(Exception exception, params string[] tags)
{
this.Trace(exception.Message, exception, tags);
this.Trace(null, exception, tags);
}
/// <summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment