Minor refactoring/formatting fixes
This commit is contained in:
parent
cbefcdcad7
commit
f9bff6acab
3 changed files with 8 additions and 8 deletions
|
|
@ -1,13 +1,10 @@
|
||||||
|
|
||||||
#[allow(clippy::print_stderr)]
|
#[allow(clippy::print_stderr)]
|
||||||
pub fn elog(function: &str, message: &str) {
|
pub fn elog(function: &str, message: &str) {
|
||||||
eprintln!("{:?} [{function}] {message}", crate::ONSET.elapsed());
|
eprintln!("{:?} [{function}] {message}", crate::ONSET.elapsed());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paths in this slice suppress logging if found in the stack trace
|
// Paths in this slice suppress logging if found in the stack trace
|
||||||
pub const SKIP_PATHS: &[&str] = &[
|
pub const SKIP_PATHS: &[&str] = &["en::types::Config::parse_text"];
|
||||||
"en::types::Config::parse_text"
|
|
||||||
];
|
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! log {
|
macro_rules! log {
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,15 @@ async fn main() -> io::Result<()> {
|
||||||
);
|
);
|
||||||
|
|
||||||
let level: u8 = std::env::var("RUST_BACKTRACE")
|
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());
|
eprintln!(" P! [{:?}] {location}: {payload}", ONSET.elapsed());
|
||||||
|
|
||||||
let trace = backtrace::Backtrace::capture();
|
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:#?}");
|
eprintln!("\n Stack trace:\n{trace:#?}");
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,8 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn render_anchor() {
|
fn render_anchor() {
|
||||||
let anchor = Anchor::new("AnchorText", "AnchorDest", true, false, false);
|
let anchor =
|
||||||
|
Anchor::new("AnchorText", "AnchorDest", true, false, false);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
anchor.render(),
|
anchor.render(),
|
||||||
r#"<a href="/node/AnchorDest">AnchorText</a>"#
|
r#"<a href="/node/AnchorDest">AnchorText</a>"#
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue