serilog-contrib / serilog-settings-xml Goto Github PK
View Code? Open in Web Editor NEWXml file based configuration for Serilog (https://serilog.net)
License: Apache License 2.0
Xml file based configuration for Serilog (https://serilog.net)
License: Apache License 2.0
Details here: serilog/serilog#1020
It would be great to have xsd schema for autocomplition in Visual Studio as it done on NLog and log4net.
Probably it must be separate package.
Some sink implementations using the name of sink name which is different from namespace. To support this we need to introduce value
in using
part of the config.
Here is example for https://github.com/saleem-mirza/serilog-sinks-azure-analytics.
app.config
way of configuring:
<appSettings>
<add key="serilog:using:AzureLogAnalytics" value="Serilog.Sinks.AzureAnalytics" />
</appSettings>
Expected xml
way of configuring:
<serilog>
<using>
<add key="AzureLogAnalytics" value="Serilog.Sinks.AzureAnalytics"/>
</using>
</serilog>
Having only value should be still supported:
<serilog>
<using>
<add value="Serilog.Enrichers.Thread" />
<add value="Serilog.Enrichers.Process" />
<add value="Serilog.Sinks.Seq" />
</using>
</serilog>
The configuration sample on the front page didn't work for me - no File sink got created.
Eventually, after a long time!, I worked out that needed to be added to the using section.
I know you guys would have realised that immediately but I am a newbie to serilog.
Also, the Xml extension method allows a null filePath but the XmlSettings ctor throws if it is null.
Can I suggest that a null filePath doesn't throw but instead Configure(), on seeing a null filePath, gets the xml from the config file instead: Its the identical Xml section and still goes to create identical KeyValuePairs, just from a different place.
(I know this works because I copied your code - since it is sealed and non-virtual - and tried it out)
On a LoggerConfiguration instance, I can't find a way of getting the MinimumLevel LogEventLevel.
Either from the _minimumLevel field or the MinimumLevelConfiguration - neither has anything public.
Reason for needing it:
I create a LoggerConfiguration from the app.config file and now want to set it's MinimumLevel.ControlledBy to a LevelSwitch but I can't pre-initialize that LevelSwitch with the current LogEventLevel as it is hidden away.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.