MCPcopy Create free account
hub / github.com/PRQL/prql / write_debug_log

Function write_debug_log

prqlc/prqlc/src/debug/render_html.rs:32–114  ·  view source on GitHub ↗
(w: &mut W, debug_log: &DebugLog)

Source from the content-addressed store, hash-verified

30}
31
32fn write_debug_log<W: Write>(w: &mut W, debug_log: &DebugLog) -> Result {
33 writeln!(w, "<!doctype html>")?;
34 writeln!(w, "<html>")?;
35 writeln!(w, "<head>")?;
36 writeln!(w, r#"<meta charset="utf-8">"#)?;
37 writeln!(w, "<title>prqlc debug log {}</title>", debug_log.started_at)?;
38 writeln!(w, r#"<meta name="generator" content="prqlc">"#)?;
39 writeln!(w, r#"<meta name="robots" content="noindex">"#)?;
40 writeln!(w, "<style>{CSS_STYLES}</style>")?;
41 writeln!(w, "<script>{JS_SCRIPT}</script>")?;
42 writeln!(w, "</head>")?;
43 writeln!(w, "<body>")?;
44
45 // header
46 {
47 writeln!(w, "<header>")?;
48 writeln!(w, "<h1>prqlc debug log</h1>")?;
49
50 write_key_values(
51 w,
52 &[
53 ("started_at", &debug_log.started_at),
54 ("version", &debug_log.version),
55 ],
56 )?;
57 writeln!(w, "</header>")?;
58 }
59
60 // pre-stage entries (this should be mostly source PRQL)
61 for (index, entry) in debug_log.entries.iter().enumerate() {
62 if let DebugEntryKind::NewStage(_) = &entry.kind {
63 break;
64 }
65
66 match &entry.kind {
67 DebugEntryKind::Message(message) => {
68 write_message(w, message)?;
69 }
70 _ => {
71 write_titled_entry(w, index, entry)?;
72 }
73 }
74 }
75
76 {
77 writeln!(w, "<div class=message-filter>")?;
78 for level in ["off", "error", "warn", "info", "debug", "trace"] {
79 writeln!(
80 w,
81 r#"<input type="radio" name="message-filter" id="msg-filter-{level}">"#
82 )?;
83 writeln!(w, r#"<label for="msg-filter-{level}">{level}</label>"#)?;
84 }
85
86 writeln!(w, "</div>")?;
87 }
88
89 {

Callers 1

render_log_to_htmlFunction · 0.85

Calls 6

write_key_valuesFunction · 0.85
write_messageFunction · 0.85
write_titled_entryFunction · 0.85
write_stage_handlesFunction · 0.85
write_stage_contentsFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected