GithubHelp home page GithubHelp logo

serilog-contrib / serilog-settings-xml Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 29 KB

Xml file based configuration for Serilog (https://serilog.net)

License: Apache License 2.0

PowerShell 8.63% C# 91.37%
serilog xml-configuration serilog-configuration

serilog-settings-xml's People

Contributors

rsabirov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

serilog-settings-xml's Issues

Configuration sample issue

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)

LoggerConfiguration MinimumLevel

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.

Add support for setting the value in "using"

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>

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.