Skip to content
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

Improved logging #123

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

DanielVoogsgerd
Copy link
Member

@DanielVoogsgerd DanielVoogsgerd commented Aug 29, 2024

This uses the tracing_subscriber with EnvFilter to get log levels that can be set using environment variables.

This also enables branectl to translate a set of environment variables so that every container can get a specific log level set at start

This currently only changes the logging for the brane-api crate as an indication what this would look like.

I am not entirely happy with my solution for the env var translation in branectl, but it is good enough for a draft right now.

@Lut99, what do you think?

Marking this PR as a draft until we hash out how we want to do this, and until all workspace members have been converted.

Fixes: #116

brane-ctl/src/lifetime.rs Fixed Show fixed Hide fixed
brane-ctl/src/lifetime.rs Fixed Show fixed Hide fixed
@@ -742,10 +873,6 @@ fn run_compose(
Ok(())
}


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tssk, someone is removing all by formatting whitespace :P

@Lut99
Copy link
Member

Lut99 commented Sep 2, 2024

I'm trying to check out how it looks like, but it seems like the output of brane-api isn't very verbose by default. How can I change it? I tried

BRANE_API_LOG=DEBUG ./target/release/branectl start central

or, to try and trigger your tracing error:

BRANE_LOG=DaskjdhasdEBUG ./target/release/branectl start central

but none of them seem to have any effect on brane-apis deployment, nor do they print!() anything.

Maybe there's something weird with caching here? branectl is a little awkward in these /tmp/docker-compose-*.yml file it generates and then (never?) updates them again. But even so, removing the file and re-running has no effect.

@DanielVoogsgerd
Copy link
Member Author

DanielVoogsgerd commented Oct 8, 2024

I forgot to remove an optimization that it would not generate an overlay if there were no hostname overrides. This did not fail for me before as I used to always set host.docker.internal.

It should "work" now.

Don't expect too much however, it is still very drafty.

This uses the `tracing_subscriber` with `EnvFilter` to get log levels
that can be set using environment variables.

This also enables `branectl` to translate a set of environment variables
so that every container can get a specific log level set at start
This guard clause was a correct optimization before we set loglevels via
overrides

match std::env::var(&log_var) {
Ok(val) => return Some(val),
// TODO: Could use the trace! macro from error-trace.

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment

match std::env::var("BRANE_LOG") {
Ok(val) => return Some(val),
// TODO: Could use the trace! macro from error-trace.

Check notice

Code scanning / devskim

A "TODO" or similar was left in source code, possibly indicating incomplete functionality Note

Suspicious comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve logging
2 participants