start_command/
log_uploader.rs1use std::path::Path;
4
5use crate::execution_store::ExecutionStore;
6use crate::failure_handler::upload_log_interactive_with_options;
7
8pub fn upload_execution_log(
10 store: Option<&ExecutionStore>,
11 identifier: &str,
12) -> Result<i32, String> {
13 upload_execution_log_with_options(store, identifier, false, false)
14}
15
16pub fn upload_execution_log_with_options(
18 store: Option<&ExecutionStore>,
19 identifier: &str,
20 no_sanitize: bool,
21 verbose: bool,
22) -> Result<i32, String> {
23 let store = store.ok_or_else(|| "Execution tracking is disabled.".to_string())?;
24 let record = store.get(identifier).ok_or_else(|| {
25 format!(
26 "No execution found with UUID or session name: {}",
27 identifier
28 )
29 })?;
30
31 if record.log_path.is_empty() {
32 return Err("Execution record does not have a log path.".to_string());
33 }
34
35 if !Path::new(&record.log_path).exists() {
36 return Err(format!("Log file not found: {}", record.log_path));
37 }
38
39 upload_log_interactive_with_options(&record.log_path, no_sanitize, verbose)
40}