-
Notifications
You must be signed in to change notification settings - Fork 251
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 log format in blockchain_explorer/helpers.rs #86
Conversation
If
else:
|
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.
EXONUM_SRC_PATH
is not intuitive, i think the better name is EXONUM_LOG_VERBOSE
.
@alekseysidorov maybe not |
|
In my opinion variables with |
@alekseysidorov yep. And those are referenced in each log, if you set the variable to |
blockchain_explorer/src/helpers.rs
Outdated
.unwrap() | ||
.parse::<bool>(); | ||
if let Ok(flag) = param_parse { | ||
verbose_src_path = flag; |
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.
let verbose_src_path = match env::var("LOG_VERBOSE_SRC_FILE_LINE") {
Ok(val) => val.parse::<bool>().unwrap_or(false),
Err(_) => false,
};
Probably would be better.
blockchain_explorer/src/helpers.rs
Outdated
let now = (ts.as_secs() * 1000 + ts.subsec_nanos() as u64 / 1000000).to_string(); | ||
let secs = ts.as_secs().to_string(); | ||
let millis = (ts.subsec_nanos() as u64 / 1000000).to_string(); | ||
|
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.
Perhaps, we will need some "time utils" for such things...
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.
May be just use chrono crate and format time with rfc2822
?
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.
LGTM, but maybe move format closure into static function? And I better prefer RUST_VERBOSE_PATH
name.
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.
Oleg explained me some details, I was not right.
But can we use the slog
crate instead of this helper in our applications?
ccddf5c
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.
LGTM
Improved log format in blockchain_explorer/helpers.rs Former-commit-id: f39abde61d31c3375b61df67cf13daceba4fe75a
No description provided.