mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Optimize CSS error logging: check log level before task-local silencing.
This commit is contained in:
parent
6a2a080355
commit
4141b776c2
1 changed files with 7 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
|
||||||
use cssparser::ast::{SyntaxError, SourceLocation};
|
use cssparser::ast::{SyntaxError, SourceLocation};
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,9 +26,12 @@ impl<T, I: Iterator<Result<T, SyntaxError>>> Iterator<T> for ErrorLoggerIterator
|
||||||
/// Set a `RUST_LOG=style::errors` environment variable
|
/// Set a `RUST_LOG=style::errors` environment variable
|
||||||
/// to log CSS parse errors to stderr.
|
/// to log CSS parse errors to stderr.
|
||||||
pub fn log_css_error(location: SourceLocation, message: &str) {
|
pub fn log_css_error(location: SourceLocation, message: &str) {
|
||||||
// TODO eventually this will got into a "web console" or something.
|
// Check this first as it’s cheaper than local_data.
|
||||||
if silence_errors.get().is_none() {
|
if log_enabled!(::log::INFO) {
|
||||||
info!("{:u}:{:u} {:s}", location.line, location.column, message)
|
if silence_errors.get().is_none() {
|
||||||
|
// TODO eventually this will got into a "web console" or something.
|
||||||
|
info!("{:u}:{:u} {:s}", location.line, location.column, message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue