question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Specifying .Destructure.ByTransforming<T>() in the config

See original GitHub issue

I have migrated recently from defining Serilog config in code to appsettings.json.

I would like to be able to specify things like .Destructure.ByTransforming<CultureInfo>(c => new { c.LCID, c.Name }). Even simplified syntax would be fine.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:39 (36 by maintainers)

github_iconTop GitHub Comments

2reactions
tsimbalarcommented, May 3, 2018

Not sure if this is related and may find some commonality, but I have a repo in here, Serilog.Settings.Code, where I load the config as C# from an arbitrary file (typically a .csx file) … in case that helps 😃

It is based on Microsoft.CodeAnalysis.CSharp.Scripting which itself is based on Roslyn.

1reaction
MV10commented, May 6, 2018

Starting work on a PR for the other less complicated destructure syntax (i.e. that won’t require any new features) so that delegates can be added as a separate extensions package.

So, @zippy1981 I guess the answer to your end-game question is that I’ll be managing a nuget package with this feature. Give me a bit more time, ultimately I want parity with “real” Serilog package quality – docs, tests, Travis, and AppVeyor support. Or if anyone else feels like working on a PR in my repo for that (while I add destructure to Config), please feel free.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Serilog Destructure.ByTransforming<Interface>() not working
The Destructure.With() function can take as many polices as you want. It looks like Serilog checks for registered type destructures then it will ......
Read more >
Setting Default Values with JavaScript's Destructuring
With destructuring we can set defaults, or fallback values so that if an item is not in the object (or Array, Map, or...
Read more >
vue/no-setup-props-destructure
Rule Details ​. This rule reports the destructuring of props passed to setup causing the value to lose reactivity.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found