refactor: improve logs, unify integration log fmt
The catch-all case of `handle_client_message` now logs the atom's name instead of its opaque atom id. `get_atom_name` now warns there was an error and returns a filler name. Since most the use of `get_atom_name` is in logging, this makes those logs easier to read. The integration tests now use `formatted_timed_builder` logger constructor, which should unify the look of logs between the integration tests and the main binary.
This commit is contained in:
parent
e9ef847544
commit
53b6072bd9
2 changed files with 9 additions and 3 deletions
|
|
@ -590,7 +590,10 @@ impl XState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t => warn!("unrecognized message: {t:?}"),
|
t => warn!(
|
||||||
|
"unrecognized message: {:?}",
|
||||||
|
get_atom_name(&self.connection, t)
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1415,6 +1418,9 @@ impl XConnection for RealConnection {
|
||||||
fn get_atom_name(connection: &xcb::Connection, atom: x::Atom) -> String {
|
fn get_atom_name(connection: &xcb::Connection, atom: x::Atom) -> String {
|
||||||
match connection.wait_for_reply(connection.send_request(&x::GetAtomName { atom })) {
|
match connection.wait_for_reply(connection.send_request(&x::GetAtomName { atom })) {
|
||||||
Ok(reply) => reply.name().to_string(),
|
Ok(reply) => reply.name().to_string(),
|
||||||
Err(err) => format!("<error getting atom name: {err:?}> {atom:?}"),
|
Err(err) => {
|
||||||
|
warn!("<error getting atom name: {err:?}> {atom:?}");
|
||||||
|
format!("ATOM_{}", atom.resource_id())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ impl Fixture {
|
||||||
fn new_preset(pre_connect: impl FnOnce(&mut testwl::Server)) -> Self {
|
fn new_preset(pre_connect: impl FnOnce(&mut testwl::Server)) -> Self {
|
||||||
static INIT: Once = Once::new();
|
static INIT: Once = Once::new();
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
pretty_env_logger::env_logger::builder()
|
pretty_env_logger::formatted_timed_builder()
|
||||||
.is_test(true)
|
.is_test(true)
|
||||||
.filter_level(log::LevelFilter::Debug)
|
.filter_level(log::LevelFilter::Debug)
|
||||||
.parse_default_env()
|
.parse_default_env()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue