Coder Social home page Coder Social logo

Comments (5)

bartelink avatar bartelink commented on July 19, 2024 1

Therefore I asked if it is possible to overwrite this behavior from the outside

Have you considered asking whether the lib would consider exposing a mechanism to expose its raw data (e.g. a dictionary of values like ForContext can use) and/or use @ ? Sounds like the sort of thing that lots of people would be interested in?

As a hack until it's done, you might be able to decorate the ILogger with a helper that inserts an @ into the message template that the lib is passing,`

from serilog-extensions-logging.

nblumhardt avatar nblumhardt commented on July 19, 2024

Hi Gerald!

@ is part of the abstraction - it's recognized by the full-featured structured logging back-ends (Serilog and NLog), has been part of the https://messagetemplates.org spec since the beginning, and is accepted by Microsoft.Exensions.Logging pretty much everywhere. Raising issues with the external libraries is the best path forward :-)

Hope this helps,
Nick

from serilog-extensions-logging.

GeraldLx avatar GeraldLx commented on July 19, 2024

I know the template system now for a long time and love how it works. As long as I am in full control of the code, there is no problem.

I am just in the situation where we use a 3rd party library. (EasyNetQ, if you are interested)

The library has itΒ΄s own logging logic and provides implementations for Microsoft and Serilog.

In the end there is a line similar to this:

logger.Error(exception, "The call failed with {information}", information);

while Information is a custom class from the library with an overwritten ToString.

In Seq I can now see this
information: '[ { "Key1": "Value1", "Key2": "Value2" } ]'

So basically the serialized object as string. Of course I would prefer the same data as object in my Seq.

Currently my only chance is to fork the libraries source code and add the @.

Therefore I asked if it is possible to overwrite this behavior from the outside

from serilog-extensions-logging.

sungam3r avatar sungam3r commented on July 19, 2024

EasyNetQ/EasyNetQ#1484

from serilog-extensions-logging.

nblumhardt avatar nblumhardt commented on July 19, 2024

Closing as stale; looks like @sungam3r has helped find a solution that works with the original source library.

from serilog-extensions-logging.

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.