zlog: Fall back to printing module path instead of *unknown* or just crate name (#29691)

Closes #ISSUE

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Ben Kunkle 2025-05-01 10:59:51 -04:00 committed by GitHub
parent 122af4fd53
commit e3a2d52472
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 54 additions and 26 deletions

View file

@ -61,6 +61,8 @@ impl log::Log for Zlog {
scope: module_scope,
level,
message: record.args(),
// PERF(batching): store non-static paths in a cache + leak them and pass static str here
module_path: record.module_path().or(record.file()),
});
}
@ -80,6 +82,7 @@ macro_rules! log {
scope: logger.scope,
level,
message: &format_args!($($arg)+),
module_path: Some(module_path!()),
});
}
}
@ -267,6 +270,7 @@ impl log::Log for Logger {
scope: self.scope,
level,
message: record.args(),
module_path: record.module_path(),
});
}