-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging context refactoring #218
Conversation
I wonder why we are not using |
A structured logging context would work better for logging with rich details. Both In any case, the new logging context is agnostic to which logging library is used in the end. In my latest prototype, the concrete logging implementation is concentrated here, which uses tracing: https://github.com/informalsystems/hermes-sdk/blob/soares/logger-refactoring/crates/cosmos/cosmos-client-components/src/impls/logger.rs. I also tried to implement an alternative logging back end using With the refactoring in this PR, the main logging implementation would be using Ideally, my hope is that when something like |
Another plan I have for the longer term is to unify the API for logging and telemetry. The idea is that the logging context would also contain the telemetry or analytics back end. So for metrics that we want to collect, it is a matter of customizing the specific logging implementation so that it both logs the message as well as collecting the metrics. |
Sounds good, might streamline metrics integration when we get to it 👍 |
This PR introduces a new logging context that follows the same pattern as
CanRaiseError
, to allow for more modular logging implementations.CanLog<Details>
trait is provided, withDetails
being arbitrary struct containing additional details for structured logging.TracingLogger
context is provided which implementsCanLog
for detail types defined in the core relayer-components crate.CosmosLogger
andSovereignLogger
contexts are provided which implements the specific logging contexts by delegating toTracingLogger
. The concrete logging context are different, so that they can be extended to log external detail types.