Comments (5)
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.
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.
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.
from serilog-extensions-logging.
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)
- Serilog and compile-time logging source generation HOT 3
- Possibility to rename hard-coded "EventId" property HOT 1
- ILogger.IsEnabled not respected? HOT 1
- Serilog.Extensions.Logging vs Serilog.AspNetCore HOT 1
- Memory leak HOT 1
- AWSSeriLog not working with Maui Blazor App HOT 1
- No exceptions emitted when generated by faulty audit log configuration HOT 4
- Upgrade codebase HOT 2
- Serilog keeps throwing ArgumentNullException HOT 10
- Add API approval test
- Could not load file or assembly 'Microsoft.Extensions.Logging, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' HOT 2
- Serilog.Extensions.Logging 7.0.0 has a .NET 6.0 TFM with dependencies on 7.0 HOT 3
- Serilog.Extensions.Logging v7 .net6 requires v7 Microsoft.Extensions.Logging pkg
- Unit tests fail when run for .Net Framework HOT 2
- SerilogLogger.cs - Always calls formatter with the Exception parameter as null HOT 1
- SerilogLogger.cs: PrepareWrite Method not found Serilog.Events.LogEvent..ctor HOT 3
- Serilog .NET 8 Windows Service (worker) using BackgroundService Log file not found HOT 2
- Pass-through of `M.E.L.ILogger.BeginScope()` when using custom MEL `ILoggingProvider` as Serilog sink? HOT 5
- Avoid boxing of TState HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serilog-extensions-logging.