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
Replace tracing #4017
Replace tracing #4017
Conversation
Back to draft: I'm adding a little more functionality tomorrow (https://www.pivotaltracker.com/story/show/184003550) |
Is this ready for review? If so, please re-assign reviewers, so bot will ping them. |
@@ -0,0 +1,197 @@ | |||
use crate::level; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- No module docs.
- Should this be named
low_level
? notlog_level
?
@mwu-tow I need your review to make changes under |
#[derive(ArgEnum, Clone, Copy, Debug, PartialEq, Eq)] | ||
pub enum LogLevel { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good as it is, but the project/wasm.rs
equivalent can derive ArgEnum
as well and make this superfluous.
This is a tradeoff between separation (we keep CLI arguments representation separate from the environment variables for wasm) and duplication.
/// Compiles Enso with given log level. If not set, defaults to [`warn`]. | ||
#[clap(long, arg_enum, enso_env())] | ||
pub log_level: Option<LogLevel>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than write what the default is in the documentation, I'd just remove Option
, set default_value_t
and let clap
take care of presenting this,
@@ -84,6 +106,14 @@ pub struct BuildInput { | |||
#[clap(long, arg_enum, enso_env())] | |||
pub profiling_level: Option<ProfilingLevel>, | |||
|
|||
/// Compiles Enso with given log level. If not set, defaults to [`warn`]. | |||
#[clap(long, arg_enum, enso_env())] | |||
pub log_level: Option<LogLevel>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider prefixing this flag's name and the other one's with wasm_
prefix. Having just a --log-level
among tons of projects is quite generic.
Rename the CLI option to set the WASM log level; applied some suggested simplifications, to `LogLevel` and to the type it was based on. # Important Notes This addresses review of #4017.
Pull Request Description
Logging: Replace tracing with an efficient logging implementation, with 0-runtime cost for disabled log levels. (https://www.pivotaltracker.com/story/show/183755412)
Profiling: Support submitting
profiler
events to the User Timing Web API, so that measurements can be viewed directly in the browser. (https://www.pivotaltracker.com/story/show/184003550)Important Notes
Logging interface:
warn!
, etc.) now take standardformat_args!
arguments (the tracing implementations accepted a broader syntax)../run ide start --log-level=trace --uncollapsed-log-level=info
Profiling:
profiler
events logged since the application was loaded to the Web API, so that they can then be viewed with the browser's developer tools. Note that standard tools are not able to represent async task lifetimes or metadata; this is a convenient interface to a subset ofprofiler
data.Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.