Skip to content

changing formatter priv ctor to public, needed to configure serilog programmatically #218

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

tstojecki
Copy link
Contributor

@tstojecki tstojecki commented Mar 15, 2023

Fixes #217

Changes

Changing SerilogLogMessageFormatter ctor from private to public to be able to use in config like so

configBuilder.LogMessageFormatter = typeof(SerilogLogMessageFormatter); 

Otherwise this exception is thrown at runtime
Akka.Configuration.ConfigurationException: 'LogMessageFormatter Type must have an empty constructor'

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

Latest dev Benchmarks

Include data from the relevant benchmark prior to this change here.

This PR's Benchmarks

Include data from after this change here.

@@ -20,7 +20,7 @@ public class SerilogLogMessageFormatter : ILogMessageFormatter
/// <summary>
/// Initializes a new instance of the <see cref="SerilogLogMessageFormatter"/> class.
/// </summary>
private SerilogLogMessageFormatter()
public SerilogLogMessageFormatter()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - may as well leave the singleton there for backwards compat for now.

@Aaronontheweb Aaronontheweb merged commit 1596111 into akkadotnet:dev Mar 15, 2023
@tstojecki tstojecki deleted the serilog-formatter-public-ctor-for-config branch March 16, 2023 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SerilogMessageFormatter CTOR is private, can't be instantiated as the default LogMessageFormatter
2 participants