Minor refactoring/formatting fixes

This commit is contained in:
Juno Takano 2026-01-03 16:01:56 -03:00
commit f9bff6acab
3 changed files with 8 additions and 8 deletions

View file

@ -1,13 +1,10 @@
#[allow(clippy::print_stderr)]
pub fn elog(function: &str, message: &str) {
eprintln!("{:?} [{function}] {message}", crate::ONSET.elapsed());
}
// Paths in this slice suppress logging if found in the stack trace
pub const SKIP_PATHS: &[&str] = &[
"en::types::Config::parse_text"
];
pub const SKIP_PATHS: &[&str] = &["en::types::Config::parse_text"];
#[macro_export]
macro_rules! log {

View file

@ -21,13 +21,15 @@ async fn main() -> io::Result<()> {
);
let level: u8 = std::env::var("RUST_BACKTRACE")
.unwrap_or("0".to_string()).trim().parse().unwrap_or(0);
.unwrap_or("0".to_string())
.trim()
.parse()
.unwrap_or(0);
eprintln!(" P! [{:?}] {location}: {payload}", ONSET.elapsed());
let trace = backtrace::Backtrace::capture();
if trace.status() == backtrace::BacktraceStatus::Captured && level > 1
{
if trace.status() == backtrace::BacktraceStatus::Captured && level > 1 {
eprintln!("\n Stack trace:\n{trace:#?}");
}
}));

View file

@ -73,7 +73,8 @@ mod tests {
#[test]
fn render_anchor() {
let anchor = Anchor::new("AnchorText", "AnchorDest", true, false, false);
let anchor =
Anchor::new("AnchorText", "AnchorDest", true, false, false);
assert_eq!(
anchor.render(),
r#"<a href="/node/AnchorDest">AnchorText</a>"#