Coder Social home page Coder Social logo

Comments (7)

RehanSaeed avatar RehanSaeed commented on June 12, 2024 1

@Driedas Sure!

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 12, 2024 1

Yes, as you've found it works but requires reflection to output. I'd still accept a PR to add support without using reflection.

from serilog.exceptions.

krajek avatar krajek commented on June 12, 2024

Just a question: is it worth it? The cost of reflection is negligible and paid just for the first time exception is destructured. The cost is also minuscule compared to the cost of logging anyway.
Supporting so many types of exceptions manually seems like a burden in terms of lines of code/tests/maintenance.

As was thinking even, maybe let's go the other way around, and remove all(or most) custom destructurers we have and leave just reflection-based one?

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 12, 2024

We only have a few custom destructurors at the moment. The list above just completes everything built into System.*. Some of the above are more important than others. I've added them all above for completeness.

The cost can add up if you have an app e.g. if you have an app throwing large numbers of TaskCanceledException exceptions for example which can happen in real life quite easily. There is an emphasis on performance in .NET lately, so I think it makes sense.

from serilog.exceptions.

Driedas avatar Driedas commented on June 12, 2024

Hi @RehanSaeed, would you accept a PR that adds a destructurer for RegexMatchTimeoutException?

from serilog.exceptions.

Driedas avatar Driedas commented on June 12, 2024

@RehanSaeed
heh, never mind, I've cloned the project, added the following test to prove that this isn't implemented yet:

var exception = new RegexMatchTimeoutException("input", "pattern", TimeSpan.FromSeconds(1));
Test_LoggedExceptionContainsProperty(exception, nameof(exception.Input), exception.Input);

Imagine my surprise when it turned green instead of red as expected :-). Looks like ReflectionBasedDestructurer already takes care of this using a bit of smart reflection. D'oh, TDD scores...

from serilog.exceptions.

RehanSaeed avatar RehanSaeed commented on June 12, 2024

I believe we may be able to do this with a source generator. Worth looking into.

from serilog.exceptions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.