Giter Club home page Giter Club logo

Comments (5)

ohayon avatar ohayon commented on September 26, 2024 1

Ah, disregard the last message, sorry! I am seeing now in the code change that that will respect the multiple log levels 😃.

from swift-log.

ktoso avatar ktoso commented on September 26, 2024

Interesting catch, thanks for reporting!

So this is a weird interaction between how the Logger decides if it should dispatch to the underlying handler or not, it does so by:

        if self.logLevel <= level {
            self.handler.log(level: level, ...

and the multiplex handler naively implements logLevel as:

    public var logLevel: Logger.Level {
        get {
            return self.handlers[0].logLevel

so that's going to yield surprising behaviors as you just noticed.

I think we should be setting the loglevel to the "lowest of any passed in loggers" I suppose.

I'll give this a look since I have a moment now, thanks :-)

from swift-log.

ohayon avatar ohayon commented on September 26, 2024

Thanks @ktoso ! I just read over the PR comments and that discussion is really great. It seems like a valid workaround for now would be to just reorder the handlers that are being passed into the multiplex handler?

from swift-log.

ktoso avatar ktoso commented on September 26, 2024

Correct yes, until we land that PR and the behavior changes that's what is documented and the behavior -- so yeah, you can put the "lowest" log level one first and that should work :)

from swift-log.

ohayon avatar ohayon commented on September 26, 2024

Thanks for the quick reply!

I think maybe I have misunderstood some of that conversation on the PR, but now, by switching the order of the two loggers, trace messages are still getting sent to MyLogger which has its log level set to info. Is that still expected?

from swift-log.

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.