Open prashantv opened 6 years ago
While discussing this with @abhinav, one idea I had was to use an optional struct tag to tell fx
what to log.
E.g., if we had a helper that provides a type Channel
, it shouldn't just fx.Provide(&Channel{..})
, but instead can provide an annotated version of the type which contains an extra tag,
struct {
fx.Out
Ch Channel `debuginfo:"chfx.Helper(..)"`
}
When fx
is printing debug information for a type, it can check for this extra tag and use that in place of the function name.
This is coming up in #697 as well, so I think this is something we should prioritize.
Some more ideas: re: https://github.com/uber-go/fx/pull/697
fx.Annotated
or similar to use instead of figuring it out ourselves. This is similar to the above, but we should try and capture the whole stack.
If we have helper functions that return
fx.Options
, it's not possible to skip callers for logging, so we can end up with something like:Ideally, we could customize the caller skip so we're showing something more instead of the helper functions.