serilog-sinks-elasticsearch icon indicating copy to clipboard operation
serilog-sinks-elasticsearch copied to clipboard

Support read formatStackTraceAsArray from configuration

Open AiSY-Yang opened this issue 2 years ago • 2 comments

Support read formatStackTraceAsArray from configuration

What issue does this PR address? When I Add formatStackTraceAsArray in my configuration file ,this paramater does not take effect. Like this

    "WriteTo": [
      {
        "Name": "Elasticsearch",
        "Args": {
          "nodeUris": "http://localhost:9200/",
          "typeName": null,
          "formatStackTraceAsArray": true
        }
      }
    ]

So I add paramater to LoggerConfiguration method

Does this PR introduce a breaking change? No breaking I add paramater to the end

Please check if the PR fulfills these requirements

  • [ ] The commit follows our guidelines
  • [ ] Unit Tests for the changes have been added (for bug fixes / features)

Other information:

AiSY-Yang avatar Aug 16 '22 09:08 AiSY-Yang

Thanks, although added to the back and being optional, does however still makes it breaking. It is not a binary-compatible change as the call site changes. I m a bit hesitant to accept as the method signature is already long, too long IMHO. Is there a way for you to work around it?

mivano avatar Aug 17 '22 13:08 mivano

It looks like you have a problem with test script The test is pass but have error in test report stage

The Serilog only support inject paramater in method parameters,can't modify property after constructor. so when you want to set all properties in a configuration file , must hav a method include all properties of ElasticsearchSinkOptions . It can be an extension method or a constructor ,Add a constructor of ElasticsearchSinkOptions is same as this PR.

I just want to set everything in the configuration file,If that's hard I can continue to set parameters through the program

AiSY-Yang avatar Aug 18 '22 08:08 AiSY-Yang