logger in editor

This commit is contained in:
Irina Rueegg 2026-05-25 11:03:38 +02:00
parent 59ff3ead93
commit d28c0157d8

View File

@ -52,8 +52,10 @@ def _rename_dialog(file_path: str):
if st.session_state.active_file == file_path:
st.session_state.active_file = new_file_path
st.rerun()
logger.info("Rename file %s to %s successfull", file_path, new_name )
else:
st.error("Rename failed. Check that the file still exists.")
logger.warning("Rename failed.")
st.error("Rename failed. Check that the file %s still exists.", file_path)
with col2:
if st.button("Cancel", use_container_width=True):
st.rerun()
@ -78,8 +80,10 @@ def _delete_dialog(abs_file_path: str):
if st.session_state.open_files else None
)
st.rerun()
logger.info("Deleting file %s successfull.", abs_file_path)
else:
st.error("Delete failed. Check that the file still exists.")
logger.warning("Deleting file %s failed.", abs_file_path)
with col2:
if st.button("Cancel", use_container_width=True):
st.rerun()
@ -97,18 +101,16 @@ def run_active_file():
return
execution_engine = ExecutionEngine()
debug_logger = DebugLogger()
debug_logger.clear()
debug_logger.log(f"Executing code from {active_file}...")
logger.info("Executing code from %s...", active_file)
with st.spinner(f"Running {Path(active_file).name}..."):
output = execution_engine.run_code(Path(active_file))
if output["rc"] == 0:
debug_logger.log("Execution completed successfully.")
logger.info("Execution completed successfully.")
else:
debug_logger.log_error(f"Execution failed with exit code {output['rc']}.")
logger.error("Execution failed with exit code %s.", output['rc'])
st.session_state.code_execution_output = {
"stdout": output["stdout"],