GithubHelp home page GithubHelp logo

Comments (4)

alexvazquez avatar alexvazquez commented on August 20, 2024 1

Is this going be fixed?

from serilog-sinks-slack.

WebSerGe avatar WebSerGe commented on August 20, 2024

I found the issue, Serilog.Sinks.Slack/Models/SlackSinkOptions.cs contains MinimumLogEventLevel and no more options related to log level. However, if RestrictedToMinimumLevel (which is absent in SlackSinkOption) is added to configuration file appsettings.json then filtering of events works.
RestrictedToMinimumLevel exists in Serilog.Sinks.Slack/SlackLoggerConfigurationExtensions.cs and MinimumLogEventLevel is absent there.

from serilog-sinks-slack.

TrapperHell avatar TrapperHell commented on August 20, 2024

Apologies for the delay. I meant to get back to you sooner, but I've been quite busy. Unfortunately there's a couple of issues here, so I can't quite decide what would be the best course of action.

Let's start off with the simple bit: The MinimumLogEventLevel property may be a somewhat misleading since it's available in the options file, but not within the configuration extensions.

The fix for it is somewhat unclear though. It is simple enough to expose the property in the configuration extensions, and the issue would be solved, however we would end up with two ways to configure the logging level. As you've quite rightly mentioned, there also exists the RestrictedToMinimumLevel property, which achieves a somewhat similar function.

There is however a couple of nuances. First off, the latter argument is handled by Serilog's sink configuration (LoggerSinkConfiguration.Sink()) and thus requires no real backing-property in the Options model, or custom-logic to make it work. However at runtime this property can only be raised (ie. the minimum level cannot be lowered). Going off at a tangent, it does seem like the method I've indicated here is due for removal from Serilog at some time (as the message reads: Provided for binary compatibility for earlier versions, should be removed in 3.0. [...]).

On the other hand, the MinimumLogEventLevel property allows for both raising and lowering at runtime, however this is manually controlled by the sink logic (which should already be in place).

My main concern here is that adding another argument that controls logging level in the configuration may make matters all the more confusing, and downright replacing the other argument is probably a bad idea (even though not breaking).

At this point I'm not sure whether to just add this argument as well in the configuration extensions, or if there's a better way of achieving all this. I'll need to think about it some more. In the mean time, feedback is welcome.

from serilog-sinks-slack.

TrapperHell avatar TrapperHell commented on August 20, 2024

Hi @alexvazquez ,

The issue is still open, and intended to be fixed at some point, however I don't think it would be any time soon (at least not from my end). However if you'd like to adjust it to match your needs, I don't think it should be too intensive. You could also issue a pull-request if you do go on about fixing it, and I'll see if I can include it in the base.

I'm pretty time-constrained at the moment, and there are some other matters with the project that I would like to address before going over this.

from serilog-sinks-slack.

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.