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

Function write_log

prqlc/prqlc/src/cli/mod.rs:565–587  ·  view source on GitHub ↗
(path: &std::path::Path)

Source from the content-addressed store, hash-verified

563}
564
565pub fn write_log(path: &std::path::Path) -> Result<()> {
566 let debug_log = if let Some(debug_log) = debug::log_finish() {
567 debug_log
568 } else {
569 return Err(anyhow!(
570 "debug log was started, but it cannot be found after compilation"
571 ));
572 };
573 match path.extension().and_then(|s| s.to_str()) {
574 Some("json") => {
575 let file = BufWriter::new(File::create(path)?);
576 serde_json::to_writer(file, &debug_log)?;
577 }
578 Some("html") => {
579 let file = BufWriter::new(File::create(path)?);
580 debug::render_log_to_html(file, &debug_log)?;
581 }
582 _ => {
583 return Err(anyhow!("unknown debug log format for file {path:?}"));
584 }
585 }
586 Ok(())
587}
588
589fn drop_module_def(stmts: &mut Vec<pr::Stmt>, name: &str) {
590 stmts.retain(|x| x.kind.as_module_def().map_or(true, |m| m.name != name));

Callers 1

executeMethod · 0.85

Calls 2

log_finishFunction · 0.85
render_log_to_htmlFunction · 0.85

Tested by

no test coverage detected