Git Product home page Git Product logo

Comments (4)

glibsm avatar glibsm commented on May 15, 2024

@DAddYE Thanks for the feedback, that's a good point.

I believe we started out with the logger on the Host interface but it was removed during the transition to context-aware logging. Zap 1.0 release reverted a lot of our custom ulog code and looks like the logger lost it's home.

We'll see about adding it back before the next release to make it easier for the owners in the mean time.

The good news is that a lot of the Host interface is going to disappear soon and you will be able to dependency inject all of its existing components into your handlers and/or other custom structs. That prototyping and proofing work is currently in progress and is expected to finish before the final release of 1.0

from fx.

DAddYE avatar DAddYE commented on May 15, 2024

Thanks for the answer!

The good news is that a lot of the Host interface is going to disappear soon and you will be able to dependency inject all of its existing components into your handlers and/or other custom structs

So it is better if I don't pass now svc (service.Host) as dependency? Do you guys suggest to pass: metrics, logger, tracer etc... separately?

from fx.

glibsm avatar glibsm commented on May 15, 2024

I think it's better to pass components of service.Host individually into the appropriate places. For example, if you piece of service code requires metrics and config, pass in Metrics() and Config() from the service.Host into that code.

Accepting service.Host as a parameter is very confusing because it's not immediately clear which pieces are required.

It will also make your code easier to test.

from fx.

akshayjshah avatar akshayjshah commented on May 15, 2024

Since we've taken a completely different direction with the RC series of releases, this isn't relevant anymore. Luckily, this problem is solved much more neatly - it's now easy to inject anything anywhere.

from fx.

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.