feat: change log format for runner and operator #179
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You can now change the operator and runner log format. Currently you can run the binary with
keramik-operator --log-format json daemon
to change it. Thedeveloping_operator
page includes an example.I took the value from the operator cli and then set it globally in the process to be used by anyone. Alternatively, it could be piped through in config/specs (e.g.
BootstrapSpec
/BootstrapConfig
) but it didn't seem like you'd want to set them differently, and having to set multiple places is a bit annoying. As we start operator logs before we start the daemon and get access to the network context, I used the command line option and a global variable. I don't love it and am open to better options, but using the network spec isn't an option as this has to happen before we start reconciling.I thought I could get the tracing to work with just
tracing_subscriber::fmt()::json()
andtracing_subscriber::fmt().pretty()
but I didn't get the generics right and took the example from rust-ceramic to implement format for fields/events.It originally had multiple CLI args, but switched to using the one from telemetry every where else. I had to add clap a dependency to common, but it's not optional in the workspace currently so it didn't change anything. I did this in its own commit if we prefer the multiple args option, or if there's a better solution I'm missing.