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