Skip to content
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

Is it possible to specify value for named parameters of constructor #167

Closed
vhatsura opened this issue Mar 17, 2019 · 2 comments
Closed

Comments

@vhatsura
Copy link

Hey, guys!

In some case I need to specify named parameters of constructor (in most cases, it's needed for custom formatters).
Let's see it on a simple example.
To use custom formatter with Console sink we can use the following configuration:

{
  "Serilog": {
    "WriteTo": [
      {
        "Name": "Console",
        "Args": {
          "formatter": "JsonValueFormatter "
        }
      }
    ]
  }
}

Is it possible to somehow in above example to specify typeTagName parameter of constructor?

If it isn't possible to do, I will appreciate for ability to implement such functionality by myself.

@tsimbalar
Copy link
Member

Hi Vadim,

no it is not currently supported :-/
There has been a similar request here, with a proposed workaround if that works for you : tsimbalar/serilog-settings-comparison#1

@vhatsura
Copy link
Author

vhatsura commented Mar 18, 2019

Hi, @tsimbalar.

Thanks for the link. The proposed workaround is interisting and can be helpful, however not in all scenario.

As an example, for ExceptionAsObjectJsonFormatter from Serilog.Formatting.Elasticsearch package it can be hard to precreate formatters with all possible combinations of parameters.

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

No branches or pull requests

3 participants