GithubHelp home page GithubHelp logo

Comments (3)

Tratcher avatar Tratcher commented on July 25, 2024
  1. If we inject ILoggerFactory via DI, you can't make it optional.
  2. Hosting should provide an implementation, even if it's a NullLoggerFactory that returns a NullLogger. Individual middleware shouldn't have to deal with this.
  3. Consider defining NullLoggerFactory in the Logging assembly.

from security.

Eilon avatar Eilon commented on July 25, 2024

Yeah I'm not sure whether we want to use a null object pattern here or not. There are certainly both pros and cons (having to write null checks vs. unnecessary calls into a black hole).

As far as being optional with DI, there are two ways to achieve this:

  1. Instead of injecting, use GetService (and catch exceptions if it throws)
  2. Take in an IEnumerable<ILoggerFactory> and check that you got either 0 or 1 back.

I'm sure that within minutes both @lodejard and @davidfowl will read this and have simultaneous heart attacks 💔 💔 but I'm curious what they'll say.

from security.

Praburaj avatar Praburaj commented on July 25, 2024

I moved this bug to Hosting repo as it make sense to have this ILoggerFactory created in hosting. Here is the bug in hosting : aspnet/Hosting#20

from security.

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.