style: Better debugging for stylesheets and URLs.

Bug: 1470145
Reviewed-by: xidorn
MozReview-Commit-ID: FIcz2K1ZYX0
This commit is contained in:
Emilio Cobos Álvarez 2018-06-21 13:09:35 +02:00
parent 46e572a497
commit f564b32b75
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 63 additions and 28 deletions

View file

@ -7,7 +7,6 @@
#![deny(missing_docs)]
use cssparser::{BasicParseErrorKind, ParseErrorKind, SourceLocation, Token};
use log;
use std::fmt;
use style_traits::ParseError;
use stylesheets::UrlExtraData;
@ -229,8 +228,10 @@ pub trait ParseErrorReporter {
/// This logging is silent by default, and can be enabled with a `RUST_LOG=style=info`
/// environment variable.
/// (See [`env_logger`](https://rust-lang-nursery.github.io/log/env_logger/).)
#[cfg(feature = "servo")]
pub struct RustLogReporter;
#[cfg(feature = "servo")]
impl ParseErrorReporter for RustLogReporter {
fn report_error(
&self,
@ -238,6 +239,7 @@ impl ParseErrorReporter for RustLogReporter {
location: SourceLocation,
error: ContextualParseError,
) {
use log;
if log_enabled!(log::Level::Info) {
info!(
"Url:\t{}\n{}:{} {}",