feat(node): allow configuration of logging through configuration file#2500
feat(node): allow configuration of logging through configuration file#2500
Conversation
Code ReviewTwo issues found: 1. Missing
|
That's fine. Toml file is not used in prod yet.
That's intened. Env variables won't be able to be passed from launcher anyway in prod settings. |
| #[tokio::test(flavor = "multi_thread")] | ||
| #[test_log::test(tokio::test(flavor = "multi_thread"))] | ||
| async fn test_many_triple_generation() { | ||
| init_logging(LogFormat::Plain); |
There was a problem hiding this comment.
why did you remove it?
netrome
left a comment
There was a problem hiding this comment.
Nice stuff, although I think the new variant loses some features of the existing env filter that would be nice to retain.
| use tokio::time::timeout; | ||
|
|
||
| #[tokio::test] | ||
| #[test_log::test] |
There was a problem hiding this comment.
Why and when do we need these now? It doesn't seem to be on all tests?
There was a problem hiding this comment.
See the diff for removed code. Previously we called init_logging (prod logggin) for tests. Since init_logging API changed I didn't want to litter all callsites with building a logconfig, instead reusing this crate which is good for logging/traces during tests.
There was a problem hiding this comment.
Ah I see. I think some of these tests aren't testing the logs though and should run without it imo, but we can clean that up later.
| fn env_filter(log_level: Option<Level>) -> EnvFilter { | ||
| match log_level { | ||
| Some(level) => EnvFilter::new(level.as_str()), | ||
| None => EnvFilter::from_default_env(), |
There was a problem hiding this comment.
Feels a bit weird to use an "env filter" when we're not using the env anymore.
Also, it's quite common with more advanced filters (like enabling debug for certain modules). It would be nice to support that with the config file as well, but that could be left as a follow-up.
There was a problem hiding this comment.
it's there to not break nodes that are not in tee, and most providers that don't use toml file for configuring which we just recently introducd.
There was a problem hiding this comment.
I added a comment to make it non optional in a follow up issue once only config file is supported for launch
barakeinav1
left a comment
There was a problem hiding this comment.
we are also losing the ability to set MPC for DEBUG while having the indexer as INFO.
approving, but we should have this as a follow-up issue.
barakeinav1
left a comment
There was a problem hiding this comment.
- Logging init is still deferred to run_mpc_node(), so config parsing errors before that point are unlogged. not sure it matters in practice.
approving
closes #2498
also closes #2501