Giter Club home page Giter Club logo

Comments (9)

ktoso avatar ktoso commented on June 24, 2024

Sounds good to me, would you have a moment PR such section into the README.md perhaps?

from swift-log.

maximkrouk avatar maximkrouk commented on June 24, 2024

But what if I want to test different LogHandlers with the LoggingSystem? Seems to be impossible for now 😢

from swift-log.

maximkrouk avatar maximkrouk commented on June 24, 2024

So I found a workaround in @testable import Logging, so LoggingSystem.internalBootstrap works and it seems to be a nice way to replace LoggingSystem's factory in tests 🌚

Btw you can find beta of my LoggingKit here 🙂

from swift-log.

weissi avatar weissi commented on June 24, 2024

@maximkrouk you can construct a logger with a backend explicitly:

let logger = Logger(label: "foo") { label in
    MyAwesomeBackend(label)
}

see docs.

from swift-log.

leisurehound avatar leisurehound commented on June 24, 2024

Does this solution apply when using SwiftLog in an iOS app and its test cases? I'm finding the host app bootstraps the logging system fine, but then when loading tests I get the second bootstrapping error. I have attempted to use the lazy global variable approach above, but and finding its not protecting the bootstrapping from attempting again.

from swift-log.

weissi avatar weissi commented on June 24, 2024

@leisurehound could you send us the code you use with the lazy global? That should work.

from swift-log.

leisurehound avatar leisurehound commented on June 24, 2024

sorry, I had an unrelated config issue that was causing this, once I fixed that the tests now run without double bootstrapping the logger. Sorry for the noise.

from swift-log.

ktoso avatar ktoso commented on June 24, 2024

Thanks for looping back, closing the ticket then 👍

from swift-log.

ktoso avatar ktoso commented on June 24, 2024

Actually, the original ticket stands as to documenting the pattern, so opening.

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.