Auto merge of #21391 - paulrouget:debug_to_info, r=KiChjang

Android: Use info! instead of debug!

Fix #21390

As explained in #21390, we are missing some important logs in release builds, and nightly is not available as a debug build for testers.

For the most important logs, let's use `info` instead of `debug`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21391)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-08-14 09:23:19 -04:00 committed by GitHub
commit 9aaf7302f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 15 deletions

View file

@ -190,7 +190,7 @@ impl ServoGlue {
/// Load an URL. This needs to be a valid url. /// Load an URL. This needs to be a valid url.
pub fn load_uri(&mut self, url: &str) -> Result<(), &'static str> { pub fn load_uri(&mut self, url: &str) -> Result<(), &'static str> {
debug!("load_uri: {}", url); info!("load_uri: {}", url);
ServoUrl::parse(url) ServoUrl::parse(url)
.map_err(|_| "Can't parse URL") .map_err(|_| "Can't parse URL")
.and_then(|url| { .and_then(|url| {
@ -202,7 +202,7 @@ impl ServoGlue {
/// Reload the page. /// Reload the page.
pub fn reload(&mut self) -> Result<(), &'static str> { pub fn reload(&mut self) -> Result<(), &'static str> {
debug!("reload"); info!("reload");
let browser_id = self.get_browser_id()?; let browser_id = self.get_browser_id()?;
let event = WindowEvent::Reload(browser_id); let event = WindowEvent::Reload(browser_id);
self.process_event(event) self.process_event(event)
@ -210,13 +210,13 @@ impl ServoGlue {
/// Stop loading the page. /// Stop loading the page.
pub fn stop(&mut self) -> Result<(), &'static str> { pub fn stop(&mut self) -> Result<(), &'static str> {
debug!("TODO can't stop won't stop"); warn!("TODO can't stop won't stop");
Ok(()) Ok(())
} }
/// Go back in history. /// Go back in history.
pub fn go_back(&mut self) -> Result<(), &'static str> { pub fn go_back(&mut self) -> Result<(), &'static str> {
debug!("go_back"); info!("go_back");
let browser_id = self.get_browser_id()?; let browser_id = self.get_browser_id()?;
let event = WindowEvent::Navigation(browser_id, TraversalDirection::Back(1)); let event = WindowEvent::Navigation(browser_id, TraversalDirection::Back(1));
self.process_event(event) self.process_event(event)
@ -224,7 +224,7 @@ impl ServoGlue {
/// Go forward in history. /// Go forward in history.
pub fn go_forward(&mut self) -> Result<(), &'static str> { pub fn go_forward(&mut self) -> Result<(), &'static str> {
debug!("go_forward"); info!("go_forward");
let browser_id = self.get_browser_id()?; let browser_id = self.get_browser_id()?;
let event = WindowEvent::Navigation(browser_id, TraversalDirection::Forward(1)); let event = WindowEvent::Navigation(browser_id, TraversalDirection::Forward(1));
self.process_event(event) self.process_event(event)
@ -232,7 +232,7 @@ impl ServoGlue {
/// Let Servo know that the window has been resized. /// Let Servo know that the window has been resized.
pub fn resize(&mut self, width: u32, height: u32) -> Result<(), &'static str> { pub fn resize(&mut self, width: u32, height: u32) -> Result<(), &'static str> {
debug!("resize"); info!("resize");
self.callbacks.width.set(width); self.callbacks.width.set(width);
self.callbacks.height.set(height); self.callbacks.height.set(height);
self.process_event(WindowEvent::Resize) self.process_event(WindowEvent::Resize)
@ -464,7 +464,7 @@ impl resources::ResourceReaderMethods for ResourceReader {
Resource::QuirksModeCSS => "quirks-mode.css", Resource::QuirksModeCSS => "quirks-mode.css",
Resource::RippyPNG => "rippy.png", Resource::RippyPNG => "rippy.png",
}; };
debug!("ResourceReader::read({})", file); info!("ResourceReader::read({})", file);
self.0.readfile(file) self.0.readfile(file)
} }
fn sandbox_access_files_dirs(&self) -> Vec<PathBuf> { fn sandbox_access_files_dirs(&self) -> Vec<PathBuf> {

View file

@ -39,23 +39,25 @@ pub mod egl {
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
pub fn init() -> Result<Rc<Gl>, &'static str> { pub fn init() -> Result<Rc<Gl>, &'static str> {
debug!("init_egl"); info!("Loading EGL...");
unsafe { unsafe {
let egl = Egl; let egl = Egl;
let d = egl.GetCurrentDisplay(); let d = egl.GetCurrentDisplay();
egl.SwapInterval(d, 1); egl.SwapInterval(d, 1);
Ok(GlesFns::load_with(|addr| { let egl = GlesFns::load_with(|addr| {
let addr = CString::new(addr.as_bytes()).unwrap(); let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr(); let addr = addr.as_ptr();
let egl = Egl; let egl = Egl;
egl.GetProcAddress(addr) as *const c_void egl.GetProcAddress(addr) as *const c_void
})) });
info!("EGL loaded");
Ok(egl)
} }
} }
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
pub fn init() -> Result<Rc<Gl>, &'static str> { pub fn init() -> Result<Rc<Gl>, &'static str> {
debug!("init_egl"); info!("Loading EGL...");
let dll = b"libEGL.dll\0" as &[u8]; let dll = b"libEGL.dll\0" as &[u8];
let dll = unsafe { LoadLibraryA(dll.as_ptr() as *const _) }; let dll = unsafe { LoadLibraryA(dll.as_ptr() as *const _) };
@ -63,11 +65,13 @@ pub mod egl {
Err("Can't find libEGL.dll") Err("Can't find libEGL.dll")
} else { } else {
unsafe { unsafe {
Ok(GlesFns::load_with(|addr| { let egl = GlesFns::load_with(|addr| {
let addr = CString::new(addr.as_bytes()).unwrap(); let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr(); let addr = addr.as_ptr();
GetProcAddress(dll, addr) as *const _ GetProcAddress(dll, addr) as *const _
})) });
info!("EGL loaded");
Ok(egl)
} }
} }
} }

View file

@ -55,16 +55,20 @@ pub fn Java_com_mozilla_servoview_JNIServo_init(
log: jboolean, log: jboolean,
) { ) {
if log == JNI_TRUE { if log == JNI_TRUE {
// Note: Android debug logs are stripped from a release build.
// debug!() will only show in a debug build. Use info!() if logs
// should show up in adb logcat with a release build.
android_logger::init_once( android_logger::init_once(
Filter::default() Filter::default()
.with_min_level(Level::Debug) .with_min_level(Level::Debug)
.with_allowed_module_path("simpleservo::api") .with_allowed_module_path("simpleservo::api")
.with_allowed_module_path("simpleservo::jniapi"), .with_allowed_module_path("simpleservo::jniapi")
.with_allowed_module_path("simpleservo::gl_glue::egl"),
Some("simpleservo") Some("simpleservo")
); );
} }
debug!("init"); info!("init");
initialize_android_glue(&env, activity); initialize_android_glue(&env, activity);