Impl Output for Log
grippy opened this issue · 2 comments
I wanted to add a Log
output to this example:
https://github.com/fralalonde/dipstick/blob/master/examples/proxy_multi_output.rs
However, it looks like Log doesn't impl Output
and OutputScope
traits. I tried to add support and I'm seeing compile errors since impl Input for Log
is implemented.
One idea might be to add a second struct that implements Output and OutputScope and have it wrap the Log
struct somehow.
This is a limit of the current API which I'd like to get rid of. Input
and Output
should really one and the same. The main difference is that Input
s are Sync
while Output
are not. Because of that, there are methods to "upgrade" from Output
to Input
, such as queued()
. Also, only InputScope
s provide metrics()
for now when it should be also possible to get non-Sync
metrics straight from an OutputScope
. I've been meaning to get rid of this dichotomy for a while but always get stuck in refactoring somewhere when trying to merge them.
Log
is naturally Sync
because the underlying loggers are threadsafe, so I've made it into an Input
to reflect that fact, but that cuts it off from being used in those places where an Output
is required. The quick workaround would be to define a LogOutput
that'd mostly duplicate the existing Log
, but really this should not be necessary.
Hello, this issue has been solved at last by the release of version 0.8.0
which does away with Output
entirely, making possible to use any metrics backend anywhere. The API remains otherwise very much the same. Sorry if this took so long, the simplest solutions sometimes take the longest time to come up.