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

Include timestamp in log format #243

Open
tilacog opened this issue Jun 5, 2023 · 3 comments
Open

Include timestamp in log format #243

tilacog opened this issue Jun 5, 2023 · 3 comments
Assignees

Comments

@tilacog
Copy link
Contributor

tilacog commented Jun 5, 2023

Our logs don't include a timestamp in the log lines, we should add them.

@jainamshah102
Copy link

I am interested to work on this issue. Can you provide some guidance and assistance in resolving this.

@tilacog
Copy link
Contributor Author

tilacog commented Jul 10, 2023

Thanks, @jainamshah102!

We set up our logging here:

pub fn init_logging(log_level: LevelFilter) {
set_var("RUST_LOG", "block_oracle=trace");
let filter = EnvFilter::builder()
.with_default_directive(log_level.into())
.from_env_lossy();
let stdout = fmt::layer()
.without_time()
.with_target(false)
.with_writer(std::io::stdout);
tracing_subscriber::registry()
.with(filter)
.with(stdout)
.init();
}

We use the tracing-subscriber crate for that purpose.

It would be ideal to adjust the stdout layer to include an ISO-8501 timestamp prefixing the log message.

@jainamshah102
Copy link

@tilacog Can I pick up this issue? Can you please add me in assignees?

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

No branches or pull requests

2 participants