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

Add tracing / tracing_subscriber to make logging easier #425

Open
marcua opened this issue Aug 11, 2024 · 0 comments
Open

Add tracing / tracing_subscriber to make logging easier #425

marcua opened this issue Aug 11, 2024 · 0 comments

Comments

@marcua
Copy link
Owner

marcua commented Aug 11, 2024

  • After comparing log, slog, and tracing, it seems like tracing might have an interface as simple as log but be slightly more future-forward.
  • The tracing_subscriber json feature seems like a good place to start: structured logging as JSONL
  • One thing to figure out: for the libraries that rely on log, is there a way to still log them without needing to run env_logger::init() in addition to whatever tracing init I do?
  • Start by adding tracing to the snapshots code, which has pretty gnarly printlns

It seems like I start here

        let filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
        tracing_subscriber::fmt()
            .with_writer(file) // Optional
            .with_env_filter(filter)
            .with_max_level(Level::TRACE)
            .init();
        let work_span = span!(Level::TRACE, "work", task = "processing data");
        let _enter = work_span.enter();
        debug!("yak shaved successfully", user = "marcua");
@marcua marcua converted this from a draft issue Aug 11, 2024
marcua added a commit that referenced this issue Aug 12, 2024
marcua added a commit that referenced this issue Aug 13, 2024
* Remove not-yet-used InstantiatedSnapshot

* Move snapshot execution/scheduling out of root of snapshots module and into a submodule

* Standardize an error

* Turn TODO into an issue: #425

* Remove dependence on WalkDir; cargo fmt

* Clippy

* More Clippy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To do
Development

No branches or pull requests

1 participant