-
Notifications
You must be signed in to change notification settings - Fork 20
implicitly convert regular BusLogger
to SerilogLoggingAdapter
when ForContext
is called
#285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…n `ForContext` is called close akkadotnet#284
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detailed my changes
@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{489D8D37 | |||
build.sh = build.sh | |||
src\Directory.Build.props = src\Directory.Build.props | |||
src\Directory.Packages.props = src\Directory.Packages.props | |||
NuGet.config = NuGet.config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it easier to edit NuGet.config
from within the IDE
/// Used to test that https://github.com/akkadotnet/Akka.Logger.Serilog/issues/284 is fixed | ||
/// </summary> | ||
[Fact] | ||
public void ShouldLogMessageWithContextPropertyDefaultLogger() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests that start with a default BugLogger
and ensure that the output matches what a user would see with the SerilogLoggingAdapter
under the same conditions.
@@ -15,7 +15,18 @@ public static class SerilogLoggingAdapterExtensions | |||
/// <param name="destructureObjects">If true, the value will be serialized as a structured object if possible; if false, the object will be recorded as a scalar or simple array.</param> | |||
public static ILoggingAdapter ForContext(this ILoggingAdapter adapter, string propertyName, object value, bool destructureObjects = false) | |||
{ | |||
return adapter is not SerilogLoggingAdapter customAdapter ? adapter : customAdapter.SetContextProperty(propertyName, value, destructureObjects); | |||
if(adapter is SerilogLoggingAdapter customAdapter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The real fix
src/Directory.Build.props
Outdated
@@ -12,7 +12,7 @@ | |||
<LangVersion>10</LangVersion> | |||
</PropertyGroup> | |||
<PropertyGroup> | |||
<AkkaVersion>1.5.14</AkkaVersion> | |||
<AkkaVersion>1.5.22-beta1</AkkaVersion> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used a local beta that I created - will require Akka.NET v1.5.22 once that ships.
Changes
close #284 - requires akkadotnet/akka.net#7210 to be merged and Akka.NET v1.5.22 to get shipped.
Checklist
For significant changes, please ensure that the following have been completed (delete if not relevant):
ILoggingAdapter
intoSerilogLoggingAdapter
whenFromContext
is called. #284