servo: Merge #12733 - Print thread name and file location when panicking (from nox:panic-location); r=jdm

Source-Repo: https://github.com/servo/servo
Source-Revision: aced80b56de7921faec73cc1d0fd92c0dd4aa325
This commit is contained in:
Anthony Ramine 2016-08-04 10:02:42 -05:00
parent dc43a0a68f
commit 6fa7b6fd28

View File

@ -41,6 +41,7 @@ use servo::util::servo_version;
use std::panic;
use std::process;
use std::rc::Rc;
use std::thread;
pub mod platform {
#[cfg(target_os = "macos")]
@ -107,7 +108,13 @@ fn main() {
None => "Box<Any>",
},
};
error!("{}", msg);
let current_thread = thread::current();
let name = current_thread.name().unwrap_or("<unnamed>");
if let Some(location) = info.location() {
error!("{} (thread {}, at {}:{})", msg, name, location.file(), location.line());
} else {
error!("{} (thread {})", msg, name);
}
}));
setup_logging();