mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Bump env_logger to 0.5 and log to 0.4 in every servo crate
This commit is contained in:
parent
84513d43ba
commit
0918ac8cc7
34 changed files with 153 additions and 110 deletions
|
@ -18,7 +18,7 @@ euclid = "0.17"
|
|||
fnv = "1.0"
|
||||
gleam = "0.4.29"
|
||||
ipc-channel = "0.10"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
num-traits = "0.1.32"
|
||||
offscreen_gl_context = { version = "0.15", features = ["serde", "osmesa"] }
|
||||
serde_bytes = "0.10"
|
||||
|
|
|
@ -17,7 +17,7 @@ gleam = "0.4.29"
|
|||
image = "0.18"
|
||||
ipc-channel = "0.10"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
nonzero = {path = "../nonzero"}
|
||||
|
|
|
@ -15,7 +15,7 @@ doctest = false
|
|||
euclid = "0.17"
|
||||
getopts = "0.2.11"
|
||||
lazy_static = "1"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
num_cpus = "1.1.0"
|
||||
rustc-serialize = "0.3"
|
||||
serde = "1.0"
|
||||
|
@ -24,7 +24,7 @@ servo_url = {path = "../url"}
|
|||
url = "1.2"
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.4"
|
||||
env_logger = "0.5"
|
||||
|
||||
[target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))'.dependencies]
|
||||
xdg = "2.0"
|
||||
|
|
|
@ -25,7 +25,7 @@ hyper = "0.10"
|
|||
ipc-channel = "0.10"
|
||||
itertools = "0.7"
|
||||
layout_traits = {path = "../layout_traits"}
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
metrics = {path = "../metrics"}
|
||||
msg = {path = "../msg"}
|
||||
net = {path = "../net"}
|
||||
|
|
|
@ -111,7 +111,7 @@ use ipc_channel::ipc::{self, IpcSender, IpcReceiver};
|
|||
use ipc_channel::router::ROUTER;
|
||||
use itertools::Itertools;
|
||||
use layout_traits::LayoutThreadFactory;
|
||||
use log::{Log, LogLevel, LogLevelFilter, LogMetadata, LogRecord};
|
||||
use log::{Log, Level, LevelFilter, Metadata, Record};
|
||||
use msg::constellation_msg::{BrowsingContextId, TopLevelBrowsingContextId, PipelineId};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{PipelineNamespace, PipelineNamespaceId, TraversalDirection};
|
||||
|
@ -438,17 +438,17 @@ impl FromScriptLogger {
|
|||
}
|
||||
|
||||
/// The maximum log level the constellation logger is interested in.
|
||||
pub fn filter(&self) -> LogLevelFilter {
|
||||
LogLevelFilter::Warn
|
||||
pub fn filter(&self) -> LevelFilter {
|
||||
LevelFilter::Warn
|
||||
}
|
||||
}
|
||||
|
||||
impl Log for FromScriptLogger {
|
||||
fn enabled(&self, metadata: &LogMetadata) -> bool {
|
||||
metadata.level() <= LogLevel::Warn
|
||||
fn enabled(&self, metadata: &Metadata) -> bool {
|
||||
metadata.level() <= Level::Warn
|
||||
}
|
||||
|
||||
fn log(&self, record: &LogRecord) {
|
||||
fn log(&self, record: &Record) {
|
||||
if let Some(entry) = log_entry(record) {
|
||||
debug!("Sending log entry {:?}.", entry);
|
||||
let thread_name = thread::current().name().map(ToOwned::to_owned);
|
||||
|
@ -457,6 +457,8 @@ impl Log for FromScriptLogger {
|
|||
let _ = chan.send(msg);
|
||||
}
|
||||
}
|
||||
|
||||
fn flush(&self) {}
|
||||
}
|
||||
|
||||
/// A logger directed at the constellation from the compositor
|
||||
|
@ -475,17 +477,17 @@ impl FromCompositorLogger {
|
|||
}
|
||||
|
||||
/// The maximum log level the constellation logger is interested in.
|
||||
pub fn filter(&self) -> LogLevelFilter {
|
||||
LogLevelFilter::Warn
|
||||
pub fn filter(&self) -> LevelFilter {
|
||||
LevelFilter::Warn
|
||||
}
|
||||
}
|
||||
|
||||
impl Log for FromCompositorLogger {
|
||||
fn enabled(&self, metadata: &LogMetadata) -> bool {
|
||||
metadata.level() <= LogLevel::Warn
|
||||
fn enabled(&self, metadata: &Metadata) -> bool {
|
||||
metadata.level() <= Level::Warn
|
||||
}
|
||||
|
||||
fn log(&self, record: &LogRecord) {
|
||||
fn log(&self, record: &Record) {
|
||||
if let Some(entry) = log_entry(record) {
|
||||
debug!("Sending log entry {:?}.", entry);
|
||||
let top_level_id = TopLevelBrowsingContextId::installed();
|
||||
|
@ -495,22 +497,24 @@ impl Log for FromCompositorLogger {
|
|||
let _ = chan.send(msg);
|
||||
}
|
||||
}
|
||||
|
||||
fn flush(&self) {}
|
||||
}
|
||||
|
||||
/// Rust uses `LogRecord` for storing logging, but servo converts that to
|
||||
/// Rust uses `Record` for storing logging, but servo converts that to
|
||||
/// a `LogEntry`. We do this so that we can record panics as well as log
|
||||
/// messages, and because `LogRecord` does not implement serde (de)serialization,
|
||||
/// messages, and because `Record` does not implement serde (de)serialization,
|
||||
/// so cannot be used over an IPC channel.
|
||||
fn log_entry(record: &LogRecord) -> Option<LogEntry> {
|
||||
fn log_entry(record: &Record) -> Option<LogEntry> {
|
||||
match record.level() {
|
||||
LogLevel::Error if thread::panicking() => Some(LogEntry::Panic(
|
||||
Level::Error if thread::panicking() => Some(LogEntry::Panic(
|
||||
format!("{}", record.args()),
|
||||
format!("{:?}", Backtrace::new())
|
||||
)),
|
||||
LogLevel::Error => Some(LogEntry::Error(
|
||||
Level::Error => Some(LogEntry::Error(
|
||||
format!("{}", record.args())
|
||||
)),
|
||||
LogLevel::Warn => Some(LogEntry::Warn(
|
||||
Level::Warn => Some(LogEntry::Warn(
|
||||
format!("{}", record.args())
|
||||
)),
|
||||
_ => None,
|
||||
|
|
|
@ -11,5 +11,5 @@ path = "lib.rs"
|
|||
crate_type = ["rlib"]
|
||||
|
||||
[dependencies]
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
ws = "0.7.3"
|
||||
|
|
|
@ -14,7 +14,7 @@ devtools_traits = {path = "../devtools_traits"}
|
|||
hyper = "0.10"
|
||||
hyper_serde = "0.8"
|
||||
ipc-channel = "0.10"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
|
|
|
@ -26,7 +26,7 @@ harfbuzz-sys = "0.1"
|
|||
ipc-channel = "0.10"
|
||||
lazy_static = "1"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
msg = {path = "../msg"}
|
||||
|
|
|
@ -23,7 +23,7 @@ gfx_traits = {path = "../gfx_traits"}
|
|||
html5ever = "0.22"
|
||||
ipc-channel = "0.10"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
|
|
|
@ -26,7 +26,7 @@ layout = {path = "../layout"}
|
|||
layout_traits = {path = "../layout_traits"}
|
||||
lazy_static = "1"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
time = "0.1.17"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
metrics = {path = "../metrics"}
|
||||
|
|
|
@ -12,7 +12,7 @@ path = "lib.rs"
|
|||
[dependencies]
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
ipc-channel = "0.10"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
msg = {path = "../msg"}
|
||||
|
|
|
@ -23,7 +23,7 @@ hyper-openssl = "0.2.2"
|
|||
immeta = "0.3.6"
|
||||
ipc-channel = "0.10"
|
||||
lazy_static = "1"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
matches = "0.1"
|
||||
mime = "0.2.1"
|
||||
mime_guess = "1.8.0"
|
||||
|
|
|
@ -410,7 +410,7 @@ fn obtain_response(connector: &Pool<Connector>,
|
|||
}
|
||||
}
|
||||
|
||||
if log_enabled!(log::LogLevel::Info) {
|
||||
if log_enabled!(log::Level::Info) {
|
||||
info!("{} {}", method, url);
|
||||
for header in headers.iter() {
|
||||
info!(" - {}", header);
|
||||
|
@ -1069,7 +1069,7 @@ fn http_network_fetch(request: &Request,
|
|||
Err(error) => return Response::network_error(error),
|
||||
};
|
||||
|
||||
if log_enabled!(log::LogLevel::Info) {
|
||||
if log_enabled!(log::Level::Info) {
|
||||
info!("response for {}", url);
|
||||
for header in res.headers.iter() {
|
||||
info!(" - {}", header);
|
||||
|
|
|
@ -18,7 +18,7 @@ hyper_serde = "0.8"
|
|||
image = "0.18"
|
||||
ipc-channel = "0.10"
|
||||
lazy_static = "1"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
msg = {path = "../msg"}
|
||||
|
|
|
@ -17,7 +17,7 @@ profile_traits = {path = "../profile_traits"}
|
|||
influent = "0.4"
|
||||
ipc-channel = "0.10"
|
||||
heartbeats-simple = "0.4"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
servo_config = {path = "../config"}
|
||||
|
|
|
@ -17,7 +17,7 @@ bincode = "1"
|
|||
energy-monitor = {version = "0.2.0", optional = true}
|
||||
energymon = {git = "https://github.com/energymon/energymon-rust.git", optional = true}
|
||||
ipc-channel = "0.10"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
serde = "1.0"
|
||||
servo_config = {path = "../config"}
|
||||
signpost = {git = "https://github.com/pcwalton/signpost.git"}
|
||||
|
|
|
@ -11,6 +11,6 @@ path = "lib.rs"
|
|||
|
||||
[dependencies]
|
||||
lazy_static = "1"
|
||||
log = "0.3"
|
||||
log = "0.4"
|
||||
rand = "0.4"
|
||||
uuid = "0.6.2"
|
||||
|
|
|
@ -13,5 +13,5 @@ doctest = false
|
|||
|
||||
[dependencies]
|
||||
lazy_static = "1"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
nonzero = {path = "../nonzero"}
|
||||
|
|
|
@ -55,7 +55,7 @@ ipc-channel = "0.10"
|
|||
jstraceable_derive = {path = "../jstraceable_derive"}
|
||||
lazy_static = "1"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
metrics = {path = "../metrics"}
|
||||
|
|
|
@ -19,7 +19,7 @@ gfx_traits = {path = "../gfx_traits"}
|
|||
html5ever = "0.22"
|
||||
ipc-channel = "0.10"
|
||||
libc = "0.2"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
time = "0.1.17"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
|
|
|
@ -26,7 +26,7 @@ impl ParseErrorReporter for CSSErrorReporter {
|
|||
url: &ServoUrl,
|
||||
location: SourceLocation,
|
||||
error: ContextualParseError) {
|
||||
if log_enabled!(log::LogLevel::Info) {
|
||||
if log_enabled!(log::Level::Info) {
|
||||
info!("Url:\t{}\n{}:{} {}",
|
||||
url.as_str(),
|
||||
location.line,
|
||||
|
|
|
@ -23,7 +23,7 @@ bench = []
|
|||
bitflags = "1.0"
|
||||
matches = "0.1"
|
||||
cssparser = "0.23.0"
|
||||
log = "0.3"
|
||||
log = "0.4"
|
||||
fnv = "1.0"
|
||||
phf = "0.7.18"
|
||||
precomputed-hash = "0.1"
|
||||
|
|
|
@ -37,13 +37,13 @@ constellation = {path = "../constellation"}
|
|||
debugger = {path = "../debugger"}
|
||||
devtools = {path = "../devtools"}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
env_logger = "0.4"
|
||||
env_logger = "0.5"
|
||||
euclid = "0.17"
|
||||
gfx = {path = "../gfx"}
|
||||
gleam = "0.4.29"
|
||||
ipc-channel = "0.10"
|
||||
layout_thread = {path = "../layout_thread"}
|
||||
log = "0.3"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
net = {path = "../net"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
|
|
|
@ -79,13 +79,13 @@ use constellation::{Constellation, InitialConstellationState, UnprivilegedPipeli
|
|||
use constellation::{FromCompositorLogger, FromScriptLogger};
|
||||
#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))]
|
||||
use constellation::content_process_sandbox_profile;
|
||||
use env_logger::Logger as EnvLogger;
|
||||
use env_logger::Builder as EnvLoggerBuilder;
|
||||
use euclid::Length;
|
||||
#[cfg(all(not(target_os = "windows"), not(target_os = "ios")))]
|
||||
use gaol::sandbox::{ChildSandbox, ChildSandboxMethods};
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use log::{Log, LogMetadata, LogRecord};
|
||||
use log::{Log, Metadata, Record};
|
||||
use net::resource_thread::new_resource_threads;
|
||||
use net_traits::IpcSend;
|
||||
use profile::mem as profile_mem;
|
||||
|
@ -404,14 +404,13 @@ impl<Window> Servo<Window> where Window: WindowMethods + 'static {
|
|||
|
||||
pub fn setup_logging(&self) {
|
||||
let constellation_chan = self.constellation_chan.clone();
|
||||
log::set_logger(|max_log_level| {
|
||||
let env_logger = EnvLogger::new();
|
||||
let con_logger = FromCompositorLogger::new(constellation_chan);
|
||||
let filter = max(env_logger.filter(), con_logger.filter());
|
||||
let logger = BothLogger(env_logger, con_logger);
|
||||
max_log_level.set(filter);
|
||||
Box::new(logger)
|
||||
}).expect("Failed to set logger.")
|
||||
let env_logger = EnvLoggerBuilder::new().build();
|
||||
let con_logger = FromCompositorLogger::new(constellation_chan);
|
||||
let filter = max(env_logger.filter(), con_logger.filter());
|
||||
log::set_max_level(filter);
|
||||
|
||||
let logger = BothLogger(env_logger, con_logger);
|
||||
log::set_boxed_logger(Box::new(logger)).expect("Failed to set logger.");
|
||||
}
|
||||
|
||||
pub fn deinit(self) {
|
||||
|
@ -548,25 +547,29 @@ fn create_constellation(user_agent: Cow<'static, str>,
|
|||
struct BothLogger<Log1, Log2>(Log1, Log2);
|
||||
|
||||
impl<Log1, Log2> Log for BothLogger<Log1, Log2> where Log1: Log, Log2: Log {
|
||||
fn enabled(&self, metadata: &LogMetadata) -> bool {
|
||||
fn enabled(&self, metadata: &Metadata) -> bool {
|
||||
self.0.enabled(metadata) || self.1.enabled(metadata)
|
||||
}
|
||||
|
||||
fn log(&self, record: &LogRecord) {
|
||||
fn log(&self, record: &Record) {
|
||||
self.0.log(record);
|
||||
self.1.log(record);
|
||||
}
|
||||
|
||||
fn flush(&self) {
|
||||
self.0.flush();
|
||||
self.1.flush();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_logger(script_to_constellation_chan: ScriptToConstellationChan) {
|
||||
log::set_logger(|max_log_level| {
|
||||
let env_logger = EnvLogger::new();
|
||||
let con_logger = FromScriptLogger::new(script_to_constellation_chan);
|
||||
let filter = max(env_logger.filter(), con_logger.filter());
|
||||
let logger = BothLogger(env_logger, con_logger);
|
||||
max_log_level.set(filter);
|
||||
Box::new(logger)
|
||||
}).expect("Failed to set logger.")
|
||||
let env_logger = EnvLoggerBuilder::new().build();
|
||||
let con_logger = FromScriptLogger::new(script_to_constellation_chan);
|
||||
let filter = max(env_logger.filter(), con_logger.filter());
|
||||
log::set_max_level(filter);
|
||||
|
||||
let logger = BothLogger(env_logger, con_logger);
|
||||
log::set_boxed_logger(Box::new(logger)).expect("Failed to set logger.");
|
||||
}
|
||||
|
||||
/// Content process entry point.
|
||||
|
|
|
@ -42,7 +42,7 @@ html5ever = {version = "0.22", optional = true}
|
|||
itertools = "0.7.6"
|
||||
itoa = "0.3"
|
||||
lazy_static = "1"
|
||||
log = "0.3"
|
||||
log = "0.4"
|
||||
malloc_size_of = { path = "../malloc_size_of" }
|
||||
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
|
||||
matches = "0.1"
|
||||
|
@ -77,7 +77,7 @@ kernel32-sys = "0.2"
|
|||
|
||||
[build-dependencies]
|
||||
lazy_static = "1"
|
||||
log = "0.3"
|
||||
log = "0.4"
|
||||
bindgen = { version = "0.33.2", optional = true, default-features = false }
|
||||
regex = {version = "0.2", optional = true}
|
||||
walkdir = "1.0"
|
||||
|
|
|
@ -207,7 +207,7 @@ impl ParseErrorReporter for RustLogReporter {
|
|||
url: &UrlExtraData,
|
||||
location: SourceLocation,
|
||||
error: ContextualParseError) {
|
||||
if log_enabled!(log::LogLevel::Info) {
|
||||
if log_enabled!(log::Level::Info) {
|
||||
info!("Url:\t{}\n{}:{} {}", url.as_str(), location.line, location.column, error)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use applicable_declarations::ApplicableDeclarationList;
|
|||
use context::{CascadeInputs, ElementCascadeInputs, StyleContext};
|
||||
use data::{ElementStyles, EagerPseudoStyles};
|
||||
use dom::TElement;
|
||||
use log::LogLevel::Trace;
|
||||
use log::Level::Trace;
|
||||
use matching::MatchMethods;
|
||||
use properties::{AnimationRules, ComputedValues};
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
|
|
|
@ -16,7 +16,7 @@ euclid = "0.17"
|
|||
hyper = "0.10"
|
||||
image = "0.18"
|
||||
ipc-channel = "0.10"
|
||||
log = "0.3.5"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
net_traits = {path = "../net_traits"}
|
||||
regex = "0.2"
|
||||
|
|
|
@ -17,7 +17,7 @@ oculusvr = ['rust-webvr/oculusvr']
|
|||
canvas_traits = {path = "../canvas_traits"}
|
||||
euclid = "0.17"
|
||||
ipc-channel = "0.10"
|
||||
log = "0.3"
|
||||
log = "0.4"
|
||||
msg = {path = "../msg"}
|
||||
rust-webvr = {version = "0.9", features = ["openvr"]}
|
||||
script_traits = {path = "../script_traits"}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue