You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
error!() is too easily conflatable with fail!() #7386
Before they were both macros, the name of this log level was defensible:
// In days of yore...log(error,"foo");
fail "foo";
Nowadays, this is a wart in the making:
// Rust Certification Exam, Question 22: how do these differ?error!("foo");fail!("foo");
The other log level macros (info, warn, and debug) are fine. I really don't care what we replace error with, though I propose alert! if nobody has any sublime suggestions.
Making log into a macro (...again...) would solve our earlier problem of needing to have info, error, warn, and debug as pervasive constants. It would also allow people to use log to name their own variables, as so many people requested.
Assuming that error! is the most common macro, we could also simply make log!("foo") the same as log!(error, "foo").
Going back to log(level, msg) makes sense to me, I'm not sure about making log(msg) the same as log!(error, msg), I'd make info the default level instead. Thoughts?
Actually, Thinking about this a bit further and looking at 20ab30fc583baeb87bb58bb369e97003a76a8a10 I think error! is fine and having the 4 of them makes more sense. What about changing fail! instead?
After doing a bit of research on this, I disagree with renaming error! to anything else. The debug/info/warn/error log levels appear to be standard across pretty much all implementations/explanations that I could find:
And that was just for an immediate search of "error log level". If at all it seems that we're missing the fatal! and trace! log levels (although I'm not so sure about trace!).
In my opinion, the stackoverflow answer to what the log levels mean is a good summary of what each one is and specifically why error! shouldn't fail/die. I think that the fix for this issue should be better documentation about core macros rather than renaming them.
Activity
thestinger commentedon Jun 25, 2013
How about using
log!(level, "message")?bstrie commentedon Jun 26, 2013
Making log into a macro (...again...) would solve our earlier problem of needing to have
info,error,warn, anddebugas pervasive constants. It would also allow people to uselogto name their own variables, as so many people requested.Assuming that
error!is the most common macro, we could also simply makelog!("foo")the same aslog!(error, "foo").brson commentedon Jul 10, 2013
It's a wart yeah. Nominating.
catamorphism commentedon Sep 5, 2013
Sub-bug of #3309. De-nominating
flaper87 commentedon Oct 1, 2013
Going back to
log(level, msg)makes sense to me, I'm not sure about makinglog(msg)the same aslog!(error, msg), I'd makeinfothe default level instead. Thoughts?alexcrichton commentedon Oct 1, 2013
Nominating for backwards-compatible, error logging is something that while not used often should still be used occasionally.
flaper87 commentedon Oct 1, 2013
Actually, Thinking about this a bit further and looking at 20ab30fc583baeb87bb58bb369e97003a76a8a10 I think
error!is fine and having the 4 of them makes more sense. What about changingfail!instead?Some ideas:
exit,die,raisealexcrichton commentedon Oct 6, 2013
After doing a bit of research on this, I disagree with renaming
error!to anything else. The debug/info/warn/error log levels appear to be standard across pretty much all implementations/explanations that I could find:And that was just for an immediate search of "error log level". If at all it seems that we're missing the
fatal!andtrace!log levels (although I'm not so sure abouttrace!).In my opinion, the stackoverflow answer to what the log levels mean is a good summary of what each one is and specifically why
error!shouldn't fail/die. I think that the fix for this issue should be better documentation about core macros rather than renaming them.catamorphism commentedon Oct 6, 2013
I agree with @alexcrichton . In the interest of avoiding gratuitous code churn, I'm closing this.
Auto merge of rust-lang#7386 - camsteffen:fmt-workaround, r=flip1995
Merge rust-lang#7386