aboutsummaryrefslogtreecommitdiff
path: root/alacritty
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty')
-rw-r--r--alacritty/src/logging.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/alacritty/src/logging.rs b/alacritty/src/logging.rs
index cbe2ef99..545905a2 100644
--- a/alacritty/src/logging.rs
+++ b/alacritty/src/logging.rs
@@ -13,7 +13,7 @@ use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use glutin::event_loop::EventLoopProxy;
-use log::{self, Level};
+use log::{self, Level, LevelFilter};
use crate::cli::Options;
use crate::event::Event;
@@ -102,8 +102,8 @@ impl log::Log for Logger {
let index = record.target().find(':').unwrap_or_else(|| record.target().len());
let target = &record.target()[..index];
- // Only log our own crates.
- if !self.enabled(record.metadata()) || !ALLOWED_TARGETS.contains(&target) {
+ // Only log our own crates, except when logging at Level::Trace.
+ if !self.enabled(record.metadata()) || !is_allowed_target(record.level(), target) {
return;
}
@@ -149,6 +149,14 @@ fn create_log_message(record: &log::Record<'_>, target: &str) -> String {
message
}
+/// Check if log messages from a crate should be logged.
+fn is_allowed_target(level: Level, target: &str) -> bool {
+ match (level, log::max_level()) {
+ (Level::Error, LevelFilter::Trace) | (Level::Warn, LevelFilter::Trace) => true,
+ _ => ALLOWED_TARGETS.contains(&target),
+ }
+}
+
struct OnDemandLogFile {
file: Option<LineWriter<File>>,
created: Arc<AtomicBool>,