Skip to content

Support adding default tags as discrete values in LoggerConfiguration… #12

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

Merged
merged 2 commits into from
Apr 19, 2021

Conversation

peef
Copy link
Contributor

@peef peef commented Apr 16, 2021

… extension

Motivation

When Exceptionles sink is used together with serilog-settings-configuration package then it can be configured in appsettings.json:

"Serilog": {
    "WriteTo": [
        {
            "Name": "Exceptionless",
            "Args": {
                "apiKey": "<my-api-key>"
            }
        }
    ]
}

with the configuration code:

loggerConfiguration.ReadFrom.Configuration(cfg);

In this case it is not possible to add default tags to the sink.

The PR adds the possibility to configure default tags in appsettings.json:

"Serilog": {
    "WriteTo": [
        {
            "Name": "Exceptionless",
            "Args": {
                "apiKey": "<my-api-key>",
                "defaultTags": ["tag1", "tag2"]
            }
        }
    ]
}

Copy link
Member

@niemyjski niemyjski left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! It looks good, we can simplify the add tags check and remove linq :).

@peef
Copy link
Contributor Author

peef commented Apr 19, 2021

If the PR will be accepted and merged, could be new version of the nuget package released, please?

@niemyjski niemyjski merged commit 1292296 into exceptionless:master Apr 19, 2021
@niemyjski
Copy link
Member

niemyjski commented Apr 19, 2021

Thanks for the pr

@ejsmith
Copy link
Member

ejsmith commented Apr 19, 2021

I was looking at this and thinking it would be good to all DefaultData to be added to as well, but then I thought... this logging sink has to be using an ExceptionlessClient instance under the hood... why don't we just configure these things on the client? I guess it doesn't hurt anything and make it more discoverable to have them here as well.

@peef
Copy link
Contributor Author

peef commented Apr 20, 2021

Thank you for merging. I can see there is new version v89 released, but the nupkg asset has still old version (3.1.3). Could the new version (3.1.4) be released also to NuGet public gallery, please?

@peef
Copy link
Contributor Author

peef commented Apr 20, 2021

@ejsmith I can see the sink creates new instance of the ExceptionlessClient, see the code. AFAIK there is only way how to add default tags: via default ExceptionlessClient.Default instance. So in the case of this PR it is probably not possible to add default tags to the under hood client. But correct me if I'm wrong, please.

BTW I cannot see the issue tracker in this project, but maybe it would be nice having it for similar discussions.

@peef peef deleted the support-default-tags branch April 20, 2021 07:47
@niemyjski
Copy link
Member

I just pushed a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants