aboutsummaryrefslogtreecommitdiff
path: root/src/logging.rs
diff options
context:
space:
mode:
authorgolem131 <golem131@users.noreply.github.com>2018-01-26 23:20:42 +0300
committerChristian Duerr <chrisduerr@users.noreply.github.com>2018-01-26 20:20:42 +0000
commitb82622e9948d1c90fc628739c7f328816214fb33 (patch)
tree4b0d306460c302258953f758c19cba60bad2ee06 /src/logging.rs
parent59b561b440060e7b0d13160fb69519d127e6c687 (diff)
downloadalacritty-b82622e9948d1c90fc628739c7f328816214fb33.tar.gz
alacritty-b82622e9948d1c90fc628739c7f328816214fb33.zip
Update dependencies
Updated the version of some dependencies. This also changes to a new clippy version so clippy can work with the latest nightly compiler again. Some issues created by new lints have been fixed.
Diffstat (limited to 'src/logging.rs')
-rw-r--r--src/logging.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/logging.rs b/src/logging.rs
index 1fe769fd..ff2a7735 100644
--- a/src/logging.rs
+++ b/src/logging.rs
@@ -23,14 +23,14 @@ use std::io;
use cli;
pub struct Logger<T> {
- level: log::LogLevelFilter,
+ level: log::LevelFilter,
output: sync::Mutex<T>
}
impl<T: Send + io::Write> Logger<T> {
// False positive, see: https://github.com/rust-lang-nursery/rust-clippy/issues/734
#[cfg_attr(feature = "clippy", allow(new_ret_no_self))]
- pub fn new(output: T, level: log::LogLevelFilter) -> Logger<io::LineWriter<T>> {
+ pub fn new(output: T, level: log::LevelFilter) -> Logger<io::LineWriter<T>> {
Logger {
level: level,
output: sync::Mutex::new(io::LineWriter::new(output))
@@ -39,28 +39,27 @@ impl<T: Send + io::Write> Logger<T> {
}
impl<T: Send + io::Write> log::Log for Logger<T> {
- fn enabled(&self, metadata: &log::LogMetadata) -> bool {
+ fn enabled(&self, metadata: &log::Metadata) -> bool {
metadata.level() <= self.level
}
- fn log(&self, record: &log::LogRecord) {
+ fn log(&self, record: &log::Record) {
if self.enabled(record.metadata()) && record.target().starts_with("alacritty") {
if let Ok(ref mut writer) = self.output.lock() {
writer.write_all(format!("{}\n", record.args()).as_ref()).expect("Error while logging!");
}
}
}
+
+ fn flush(&self) {}
}
pub fn initialize(options: &cli::Options) -> Result<(), log::SetLoggerError> {
// Use env_logger if RUST_LOG environment variable is defined. Otherwise,
// use the alacritty-only logger.
if ::std::env::var("RUST_LOG").is_ok() {
- ::env_logger::init()
+ ::env_logger::try_init()
} else {
- log::set_logger(|max_log_level| {
- max_log_level.set(options.log_level);
- Box::new(Logger::new(io::stdout(), options.log_level))
- })
+ log::set_boxed_logger(Box::new(Logger::new(io::stdout(), options.log_level)))
}
}