Skip to content

Conversation

@Arkatufus
Copy link
Contributor

Add enricher functionality, ILogEventEnricher enrichers can be appended at the end of the log message arguments like so:

Context.GetLogger().Info("Actor received {ID}", o, new PropertyEnricher(
    "custom-property", 
    new
    {
        name = "Custom", 
        data = counter
    }));

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.

Need to add a unit test for this I think

logger = logMessage.Enrichers.OfType<PropertyEnricher>().Aggregate(logger, (current, enricher) => current.ForContext(enricher));
}

if (logEvent.Message is LogMessage message)
Copy link
Member

Choose a reason for hiding this comment

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

LGTM but I'd like to see a unit test added to cover this

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.

Need to add a unit test for this I think

@Arkatufus
Copy link
Contributor Author

Added unit test for both default and serilog message formatter

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

@Aaronontheweb Aaronontheweb merged commit 8255627 into akkadotnet:dev May 12, 2023
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.

2 participants