Skip to content

Adds enhanced logging capabilities to OrcaSlicer, specifically around network testing and version information#448

Open
SukiSunYuhang wants to merge 7 commits into
mainfrom
feature_update_log
Open

Adds enhanced logging capabilities to OrcaSlicer, specifically around network testing and version information#448
SukiSunYuhang wants to merge 7 commits into
mainfrom
feature_update_log

Conversation

@SukiSunYuhang
Copy link
Copy Markdown

Summary

This PR adds enhanced logging capabilities to OrcaSlicer, specifically around network testing and version information.

Changes

  • Network test log sync: Sync network test logs to file for persistent diagnostics
  • Version info logging: Add software version information when manually exporting logs
  • Thread safety: Fix thread-safety issues with log_version_info and flush_logs
  • Linux locale: Initialize C library locale on Linux for correct non-ASCII character encoding
  • Network test dialog: Add condition check for the default branch in NetworkTestDialog
  • Merge main: Synced with latest main branch

- Sync NetworkTestDialog UI logs to Boost.Log file log with [NetworkTest] tag
- Add log_section_header() helper for formatted section headers in test output
- Add separator lines around version info block at startup and exit
- Log version info on normal exit (~GUI_App) and abnormal exit (generic_exception_handle)
- Remove duplicate log_version_info() call from OnExit()
feature: sync network test logs to file and enhance version info logging
…gs (#324)

* refactor: move log_version_info into GUI_App class and invoke on log export

Make log_version_info() a static method of GUI_App instead of a global
free function. Also call it from export_logs() so exported log files
always include the version information block.

* fix: delay version info logging until user confirms log export, and flush immediately

Move GUI_App::log_version_info() call in export_logs() to after the
save dialog confirmation so version info is only written when the user
actually exports. Add flush_logs() to log_version_info() to ensure the
version block is physically written to disk before the ZIP is created.

* fix: force FlushFileBuffers after log flush to prevent truncated log export on Windows

* Update utils.cpp

* Update utils.cpp

* Add Todo: flush_logs may have truncation issues.
…ocale init (#336)

* fix: thread-safety fixes for log_version_info and flush_logs, Linux locale init

- log_version_info: cache OS description with std::call_once to prevent
  wxGetLinuxDistributionInfo/wxGetOsDescription from being called on
  background threads (GTK/wx APIs are not thread-safe on Linux).
  Previously, generic_exception_handle -> OnExceptionInMainLoop could
  trigger these calls from BackgroundSlicingProcess worker threads,
  causing crashes when opening network test dialog on Linux.

- flush_logs: add mutex to protect g_log_sink shared_ptr access
  against concurrent flush calls from multiple threads.

- on_init_inner: call std::setlocale(LC_ALL, "") on Linux early in
  startup to fix garbled Chinese text and GTK file dialog crashes.

- NetworkTestDialog::start_all_job: add atomic flag to prevent
  re-entrant test launches from rapid button clicks.

* fix: add Linux paths for get_profile_version, get_flutter_version, getLocalArea, getLanguage

All four functions had empty #else (Linux) branches, causing them to always
return empty strings on Linux. Added get_linux_config_dir() helper that
resolves $XDG_CONFIG_HOME/Snapmaker_Orca or ~/.config/Snapmaker_Orca,
consistent with how data_dir() is determined on Linux.

* Fix crash issue when writing logs during network tests under extreme scenarios.

* Close the dialog with a maximum wait of 3-5 seconds; if it times out, detach and let the m_closing checkpoint handle the rest.

* refactor: move log writing to main thread and simplify update_status with CallAfter

* Update NetworkTestDialog

* Move network test log writing from worker threads to the main thread, eliminating the CallAfter crash risk.

* add log

* delete error mutex
Add a condition check for the default branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants