From e93f50702e85536b96cef48e2c84708c53d82ce5 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Mon, 26 Jan 2026 20:12:55 +0800 Subject: [PATCH] clean up --- src/slic3r/GUI/WebUserLoginDialog.cpp | 15 --- src/slic3r/Utils/BBLCloudServiceAgent.cpp | 5 +- src/slic3r/Utils/BBLNetworkPlugin.cpp | 35 +------ src/slic3r/Utils/BBLPrinterAgent.cpp | 5 +- src/slic3r/Utils/MoonrakerPrinterAgent.cpp | 65 ++----------- src/slic3r/Utils/NetworkAgent.cpp | 14 --- src/slic3r/Utils/NetworkAgentFactory.cpp | 12 --- src/slic3r/Utils/OrcaCloudServiceAgent.cpp | 104 +++------------------ src/slic3r/Utils/QidiPrinterAgent.cpp | 3 - 9 files changed, 24 insertions(+), 234 deletions(-) diff --git a/src/slic3r/GUI/WebUserLoginDialog.cpp b/src/slic3r/GUI/WebUserLoginDialog.cpp index 58f7b575ef..2e479f4cf7 100644 --- a/src/slic3r/GUI/WebUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebUserLoginDialog.cpp @@ -264,15 +264,10 @@ void ZUserLogin::OnFullScreenChanged(wxWebViewEvent &evt) void ZUserLogin::OnScriptMessage(wxWebViewEvent &evt) { wxString str_input = evt.GetString(); - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] OnScriptMessage received: " << str_input.ToStdString(); try { json j = json::parse(into_u8(str_input)); - - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] Parsed JSON successfully"; - wxString strCmd = j["command"]; - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] Command: " << strCmd.ToStdString(); NetworkAgent* agent = wxGetApp().getAgent(); if (agent && strCmd == "get_login_cmd" && agent->get_cloud_agent()) { @@ -323,30 +318,21 @@ void ZUserLogin::OnScriptMessage(wxWebViewEvent &evt) if (strCmd == "autotest_token") { m_AutotestToken = j["data"]["token"]; - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] Stored autotest_token"; } if (strCmd == "user_login") { - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] Processing user_login command"; - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] User data: " << j["data"].dump(); - j["data"]["autotest_token"] = m_AutotestToken; std::string message_json = j.dump(); - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] Calling handle_script_message with: " << message_json; - // End modal dialog first to unblock event loop before processing callbacks - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] Ending modal dialog"; EndModal(wxID_OK); // Handle message after modal dialog ends to avoid deadlock // Use wxTheApp->CallAfter to ensure it runs after modal loop exits wxTheApp->CallAfter([message_json]() { - BOOST_LOG_TRIVIAL(debug) << "[WebUserLoginDialog] Processing login message after modal ended"; wxGetApp().handle_script_message(message_json); }); } else if (strCmd == "get_localhost_url") { - BOOST_LOG_TRIVIAL(debug) << "thirdparty_login: get_localhost_url"; int loopback_port = m_loopback_port > 0 ? m_loopback_port : LOCALHOST_PORT; wxGetApp().start_http_server(loopback_port); std::string sequence_id = j["sequence_id"].get(); @@ -362,7 +348,6 @@ void ZUserLogin::OnScriptMessage(wxWebViewEvent &evt) }); } else if (strCmd == "thirdparty_login") { - BOOST_LOG_TRIVIAL(info) << "thirdparty_login: thirdparty_login"; if (j["data"].contains("url")) { std::string jump_url = j["data"]["url"].get(); int loopback_port = m_loopback_port > 0 ? m_loopback_port : LOCALHOST_PORT; diff --git a/src/slic3r/Utils/BBLCloudServiceAgent.cpp b/src/slic3r/Utils/BBLCloudServiceAgent.cpp index ee7fcf4355..5f20549db2 100644 --- a/src/slic3r/Utils/BBLCloudServiceAgent.cpp +++ b/src/slic3r/Utils/BBLCloudServiceAgent.cpp @@ -5,10 +5,7 @@ namespace Slic3r { -BBLCloudServiceAgent::BBLCloudServiceAgent() -{ - BOOST_LOG_TRIVIAL(info) << "BBLCloudServiceAgent: Constructor - using BBLNetworkPlugin singleton"; -} +BBLCloudServiceAgent::BBLCloudServiceAgent() = default; BBLCloudServiceAgent::~BBLCloudServiceAgent() = default; diff --git a/src/slic3r/Utils/BBLNetworkPlugin.cpp b/src/slic3r/Utils/BBLNetworkPlugin.cpp index e584bed17e..290de9c32b 100644 --- a/src/slic3r/Utils/BBLNetworkPlugin.cpp +++ b/src/slic3r/Utils/BBLNetworkPlugin.cpp @@ -92,12 +92,8 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) legacy_path = plugin_folder / (std::string("lib") + std::string(BAMBU_NETWORK_LIBRARY) + ".so"); #endif if (!boost::filesystem::exists(versioned_path) && boost::filesystem::exists(legacy_path)) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": auto-migrating unversioned legacy library to versioned format"; - try { boost::filesystem::rename(legacy_path, versioned_path); - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": successfully renamed " << legacy_path.string() << " to " - << versioned_path.string(); } catch (const std::exception& e) { BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": failed to rename legacy library: " << e.what(); } @@ -107,7 +103,6 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) // Load versioned library #if defined(_MSC_VER) || defined(_WIN32) library = plugin_folder.string() + "\\" + std::string(BAMBU_NETWORK_LIBRARY) + "_" + version + ".dll"; - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": loading versioned library at " << library; #else #if defined(__WXMAC__) std::string lib_ext = ".dylib"; @@ -115,7 +110,6 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) std::string lib_ext = ".so"; #endif library = plugin_folder.string() + "/" + std::string("lib") + std::string(BAMBU_NETWORK_LIBRARY) + "_" + version + lib_ext; - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": loading versioned library at " << library; #endif #if defined(_MSC_VER) || defined(_WIN32) @@ -124,10 +118,8 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) ::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str())+1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0])); m_networking_module = LoadLibrary(lib_wstr); if (!m_networking_module) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": versioned library not found, trying current directory"; std::string library_path = get_libpath_in_current_directory(std::string(BAMBU_NETWORK_LIBRARY)); if (library_path.empty()) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", can not get path in current directory for %1%") % BAMBU_NETWORK_LIBRARY; set_load_error( "Network library not found", "Could not locate versioned library: " + library, @@ -135,7 +127,6 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) ); return -1; } - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", current path %1%")%library_path; memset(lib_wstr, 0, sizeof(lib_wstr)); ::MultiByteToWideChar(CP_UTF8, NULL, library_path.c_str(), strlen(library_path.c_str())+1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0])); m_networking_module = LoadLibrary(lib_wstr); @@ -151,11 +142,9 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) library ); } - printf("after dlopen, network_module is %p\n", m_networking_module); #endif if (!m_networking_module) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", can not Load Library for %1%")%library; if (!m_load_error.has_error) { set_load_error( "Network library failed to load", @@ -165,7 +154,6 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) } return -1; } - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", successfully loaded library %1%, module %2%")%library %m_networking_module; // Load file transfer interface InitFTModule(m_networking_module); @@ -174,9 +162,7 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) load_all_function_pointers(); if (m_get_version) { - std::string ver = m_get_version(); - printf("network plugin version: %s\n", ver.c_str()); - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": network plugin version = " << ver; + (void) m_get_version(); } return 0; @@ -184,8 +170,6 @@ int BBLNetworkPlugin::initialize(bool using_backup, const std::string& version) int BBLNetworkPlugin::unload() { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", network module %1%")%m_networking_module; - UnloadFTModule(); #if defined(_MSC_VER) || defined(_WIN32) @@ -247,7 +231,6 @@ std::string BBLNetworkPlugin::get_version() const void* BBLNetworkPlugin::create_agent(const std::string& log_dir) { if (m_agent) { - BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": agent already exists"; return m_agent; } @@ -255,9 +238,6 @@ void* BBLNetworkPlugin::create_agent(const std::string& log_dir) m_agent = m_create_agent(log_dir); } - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", agent=%1%, create_agent=%2%, log_dir=%3%") - % m_agent % (m_create_agent ? "yes" : "no") % log_dir; - return m_agent; } @@ -267,8 +247,6 @@ int BBLNetworkPlugin::destroy_agent() if (m_agent && m_destroy_agent) { ret = m_destroy_agent(m_agent); } - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", agent=%1%, destroy_agent=%2%, ret=%3%") - % m_agent % (m_destroy_agent ? "yes" : "no") % ret; m_agent = nullptr; return ret; } @@ -299,13 +277,10 @@ void* BBLNetworkPlugin::get_source_module() ::MultiByteToWideChar(CP_UTF8, NULL, library.c_str(), strlen(library.c_str())+1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0])); m_source_module = LoadLibrary(lib_wstr); if (!m_source_module) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", try load BambuSource directly from current directory"); std::string library_path = get_libpath_in_current_directory(std::string(BAMBU_SOURCE_LIBRARY)); if (library_path.empty()) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", can not get path in current directory for %1%") % BAMBU_SOURCE_LIBRARY; return m_source_module; } - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", current path %1%")%library_path; memset(lib_wstr, 0, sizeof(lib_wstr)); ::MultiByteToWideChar(CP_UTF8, NULL, library_path.c_str(), strlen(library_path.c_str()) + 1, lib_wstr, sizeof(lib_wstr) / sizeof(lib_wstr[0])); m_source_module = LoadLibrary(lib_wstr); @@ -335,9 +310,6 @@ void* BBLNetworkPlugin::get_function(const char* name) function = dlsym(m_networking_module, name); #endif - if (!function) { - BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", can not find function %1%")%name; - } return function; } @@ -352,7 +324,6 @@ std::string BBLNetworkPlugin::get_libpath_in_current_directory(const std::string wchar_t file_name[512]; DWORD ret = GetModuleFileNameW(NULL, file_name, 512); if (!ret) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", GetModuleFileNameW return error, can not Load Library for %1%") % library_name; return lib_path; } int size_needed = ::WideCharToMultiByte(0, 0, file_name, wcslen(file_name), nullptr, 0, nullptr, nullptr); @@ -430,12 +401,8 @@ void BBLNetworkPlugin::remove_legacy_library() #endif if (boost::filesystem::exists(legacy_path)) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": removing legacy library at " << legacy_path.string(); boost::system::error_code ec; boost::filesystem::remove(legacy_path, ec); - if (ec) { - BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": failed to remove legacy library: " << ec.message(); - } } } diff --git a/src/slic3r/Utils/BBLPrinterAgent.cpp b/src/slic3r/Utils/BBLPrinterAgent.cpp index e547b424a5..22ce2c24a5 100644 --- a/src/slic3r/Utils/BBLPrinterAgent.cpp +++ b/src/slic3r/Utils/BBLPrinterAgent.cpp @@ -6,10 +6,7 @@ namespace Slic3r { -BBLPrinterAgent::BBLPrinterAgent() -{ - BOOST_LOG_TRIVIAL(info) << "BBLPrinterAgent: Constructor - using BBLNetworkPlugin singleton"; -} +BBLPrinterAgent::BBLPrinterAgent() = default; BBLPrinterAgent::~BBLPrinterAgent() = default; diff --git a/src/slic3r/Utils/MoonrakerPrinterAgent.cpp b/src/slic3r/Utils/MoonrakerPrinterAgent.cpp index 3c24ffe4db..e5c10bb74b 100644 --- a/src/slic3r/Utils/MoonrakerPrinterAgent.cpp +++ b/src/slic3r/Utils/MoonrakerPrinterAgent.cpp @@ -96,7 +96,6 @@ const std::string MoonrakerPrinterAgent_VERSION = "1.0.0"; MoonrakerPrinterAgent::MoonrakerPrinterAgent(std::string log_dir) : m_cloud_agent(nullptr) { - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: Constructor - log_dir=" << log_dir; (void) log_dir; } @@ -150,7 +149,6 @@ int MoonrakerPrinterAgent::connect_printer(std::string dev_id, std::string dev_i { std::lock_guard lock(connect_mutex); if (connect_in_progress.load()) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: Connection already in progress, waiting..."; // Don't reject - wait for previous connection to complete // This can happen if MonitorPanel triggers connect while previous connect is still running } else { @@ -161,7 +159,6 @@ int MoonrakerPrinterAgent::connect_printer(std::string dev_id, std::string dev_i // Wait for previous connection thread to finish if (connect_thread.joinable()) { - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: Waiting for previous connection thread..."; connect_thread.join(); } @@ -187,7 +184,6 @@ int MoonrakerPrinterAgent::connect_printer(std::string dev_id, std::string dev_i perform_connection_async(dev_id, device_info.base_url, device_info.api_key); }); - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: connect_printer launched in background - dev_id=" << dev_id; return BAMBU_NETWORK_SUCCESS; } @@ -214,13 +210,13 @@ int MoonrakerPrinterAgent::disconnect_printer() int MoonrakerPrinterAgent::check_cert() { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: check_cert (stub)"; return BAMBU_NETWORK_SUCCESS; } void MoonrakerPrinterAgent::install_device_cert(std::string dev_id, bool lan_only) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: install_device_cert (stub) - dev_id=" << dev_id << ", lan_only=" << lan_only; + (void) dev_id; + (void) lan_only; } bool MoonrakerPrinterAgent::start_discovery(bool start, bool sending) @@ -234,7 +230,7 @@ bool MoonrakerPrinterAgent::start_discovery(bool start, bool sending) int MoonrakerPrinterAgent::ping_bind(std::string ping_code) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: ping_bind (stub) - ping_code=" << ping_code; + (void) ping_code; return BAMBU_NETWORK_SUCCESS; } @@ -268,8 +264,8 @@ int MoonrakerPrinterAgent::bind_detect(std::string dev_ip, std::string sec_link, int MoonrakerPrinterAgent::bind( std::string dev_ip, std::string dev_id, std::string sec_link, std::string timezone, bool improved, OnUpdateStatusFn update_fn) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: bind (stub) - dev_id=" << dev_id; (void) dev_ip; + (void) dev_id; (void) sec_link; (void) timezone; (void) improved; @@ -279,13 +275,12 @@ int MoonrakerPrinterAgent::bind( int MoonrakerPrinterAgent::unbind(std::string dev_id) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: unbind (stub) - dev_id=" << dev_id; + (void) dev_id; return BAMBU_NETWORK_SUCCESS; } int MoonrakerPrinterAgent::request_bind_ticket(std::string* ticket) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: request_bind_ticket (stub)"; if (ticket) *ticket = ""; return BAMBU_NETWORK_SUCCESS; @@ -313,7 +308,7 @@ int MoonrakerPrinterAgent::set_user_selected_machine(std::string dev_id) int MoonrakerPrinterAgent::start_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: start_print (stub) - task_name=" << params.task_name; + (void) params; (void) update_fn; (void) cancel_fn; (void) wait_fn; @@ -322,7 +317,6 @@ int MoonrakerPrinterAgent::start_print(PrintParams params, OnUpdateStatusFn upda int MoonrakerPrinterAgent::start_local_print_with_record(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, OnWaitFn wait_fn) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: start_local_print_with_record (stub)"; (void) params; (void) update_fn; (void) cancel_fn; @@ -411,7 +405,6 @@ int MoonrakerPrinterAgent::start_local_print(PrintParams params, OnUpdateStatusF int MoonrakerPrinterAgent::start_sdcard_print(PrintParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: start_sdcard_print (stub)"; (void) params; (void) update_fn; (void) cancel_fn; @@ -478,7 +471,7 @@ int MoonrakerPrinterAgent::set_queue_on_main_fn(QueueOnMainFn fn) void MoonrakerPrinterAgent::fetch_filament_info(std::string dev_id) { - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent::fetch_filament_info (base class no-op) called for dev_id=" << dev_id; + (void) dev_id; } int MoonrakerPrinterAgent::handle_request(const std::string& dev_id, const std::string& json_str) @@ -514,7 +507,6 @@ int MoonrakerPrinterAgent::handle_request(const std::string& dev_id, const std:: } const std::string cmd = command.get(); - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: Received print command: " << cmd; // Handle gcode_line command - this is how G-code commands are sent from OrcaSlicer if (cmd == "gcode_line") { @@ -828,8 +820,6 @@ bool MoonrakerPrinterAgent::send_gcode(const std::string& dev_id, const std::str payload["script"] = gcode; std::string payload_str = payload.dump(); - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: send_gcode to " << device_info.base_url << " with payload: " << payload_str; - std::string response_body; bool success = false; std::string http_error; @@ -843,7 +833,6 @@ bool MoonrakerPrinterAgent::send_gcode(const std::string& dev_id, const std::str .timeout_connect(5) .timeout_max(10) .on_complete([&](std::string body, unsigned status_code) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: send_gcode response status=" << status_code << " body=" << body; if (status_code == 200) { response_body = body; success = true; @@ -852,7 +841,6 @@ bool MoonrakerPrinterAgent::send_gcode(const std::string& dev_id, const std::str } }) .on_error([&](std::string body, std::string err, unsigned status_code) { - BOOST_LOG_TRIVIAL(error) << "MoonrakerPrinterAgent: send_gcode error - body=" << body << " err=" << err << " status=" << status_code; http_error = err; if (status_code > 0) { http_error += " (HTTP " + std::to_string(status_code) + ")"; @@ -865,7 +853,6 @@ bool MoonrakerPrinterAgent::send_gcode(const std::string& dev_id, const std::str return false; } - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: sent gcode successfully: " << gcode; return true; } @@ -964,18 +951,14 @@ int MoonrakerPrinterAgent::send_access_code(const std::string& dev_id) void MoonrakerPrinterAgent::announce_printhost_device() { - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: announce_printhost_device() called"; - OnMsgArrivedFn ssdp_fn; { std::lock_guard lock(state_mutex); ssdp_fn = on_ssdp_msg_fn; if (!ssdp_fn) { - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: announce_printhost_device - no ssdp callback"; return; } if (ssdp_announced_host == device_info.base_url && !ssdp_announced_id.empty()) { - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: announce_printhost_device - already announced"; return; } } @@ -987,11 +970,8 @@ void MoonrakerPrinterAgent::announce_printhost_device() std::string fetch_error; if (fetch_device_info(device_info.base_url, device_info.api_key, info, fetch_error) && !info.dev_name.empty()) { dev_name = info.dev_name; - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: Got device name from printer: " << dev_name; } else { dev_name = device_info.model_name.empty() ? "Moonraker Printer" : device_info.model_name; - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: Using fallback device name: " << dev_name - << " (fetch_error=" << fetch_error << ")"; } const std::string model_id = device_info.model_id; @@ -1021,19 +1001,14 @@ void MoonrakerPrinterAgent::announce_printhost_device() ssdp_announced_id = device_info.dev_id; // Set this as the selected machine if nothing is currently selected - // This ensures auto-connect works when MonitorPanel opens if (selected_machine.empty()) { selected_machine = device_info.dev_id; - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: Auto-selected machine: " << device_info.dev_id; } } } void MoonrakerPrinterAgent::dispatch_local_connect(int state, const std::string& dev_id, const std::string& msg) { - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: dispatch_local_connect state=" << state - << " dev_id=" << dev_id << " msg=" << msg; - OnLocalConnectedFn local_fn; QueueOnMainFn queue_fn; { @@ -1042,7 +1017,6 @@ void MoonrakerPrinterAgent::dispatch_local_connect(int state, const std::string& queue_fn = queue_on_main_fn; } if (!local_fn) { - BOOST_LOG_TRIVIAL(warning) << "MoonrakerPrinterAgent: dispatch_local_connect - no callback registered!"; return; } @@ -1156,25 +1130,16 @@ void MoonrakerPrinterAgent::run_status_stream(std::string dev_id, std::string ba std::set available_objects; std::string list_error; if (fetch_object_list(base_url, api_key, available_objects, list_error)) { - // Store available_objects in member variable for feature detection { std::lock_guard lock(payload_mutex); this->available_objects = std::move(available_objects); } - std::string objects_str; - for (const auto& name : this->available_objects) { - if (!objects_str.empty()) objects_str += ", "; - objects_str += name; - } - if (this->available_objects.count("heater_bed") != 0) { subscribe_objects.insert("heater_bed"); } - // Only subscribe to "fan" if it exists (standard Moonraker API) if (this->available_objects.count("fan") != 0) { subscribe_objects.insert("fan"); - } else { } // Add toolhead for homing status @@ -1358,7 +1323,6 @@ void MoonrakerPrinterAgent::handle_ws_message(const std::string& dev_id, const s if (!current_state.empty() && current_state != last_print_state) { is_critical = true; last_print_state = current_state; - BOOST_LOG_TRIVIAL(info) << "MoonrakerPrinterAgent: Print state changed to " << current_state << ", dispatching immediately"; } } @@ -1640,7 +1604,8 @@ bool MoonrakerPrinterAgent::upload_gcode( .timeout_connect(5) .timeout_max(300) // 5 minutes for large files .on_complete([&](std::string body, unsigned status) { - BOOST_LOG_TRIVIAL(debug) << "MoonrakerPrinterAgent: Upload complete: HTTP " << status << " body: " << body; + (void) body; + (void) status; }) .on_error([&](std::string body, std::string err, unsigned status) { BOOST_LOG_TRIVIAL(error) << "MoonrakerPrinterAgent: Upload error: " << err << " HTTP " << status; @@ -1672,17 +1637,7 @@ bool MoonrakerPrinterAgent::upload_gcode( int MoonrakerPrinterAgent::pause_print(const std::string& dev_id) { - nlohmann::json request; - request["jsonrpc"] = "2.0"; - request["method"] = "printer.print.pause"; - request["id"] = next_jsonrpc_id++; - - std::string response; - // For JSON-RPC over HTTP, we need to use POST to /printer/print/pause - // But Moonraker also supports this via WebSocket - // For now, send via gcode script which is simpler - std::string gcode = "PAUSE"; - return send_gcode(dev_id, gcode) ? BAMBU_NETWORK_SUCCESS : BAMBU_NETWORK_ERR_SEND_MSG_FAILED; + return send_gcode(dev_id, "PAUSE") ? BAMBU_NETWORK_SUCCESS : BAMBU_NETWORK_ERR_SEND_MSG_FAILED; } int MoonrakerPrinterAgent::resume_print(const std::string& dev_id) diff --git a/src/slic3r/Utils/NetworkAgent.cpp b/src/slic3r/Utils/NetworkAgent.cpp index 273612365c..b893593ce2 100644 --- a/src/slic3r/Utils/NetworkAgent.cpp +++ b/src/slic3r/Utils/NetworkAgent.cpp @@ -114,16 +114,10 @@ NetworkAgent::NetworkAgent(std::string log_dir) plugin.create_agent(log_dir); } - // Create BBL sub-agents that will use the singleton m_cloud_agent = std::make_shared(); m_printer_agent = std::make_shared(); m_printer_agent->set_cloud_agent(m_cloud_agent); m_printer_agent_id = m_printer_agent->get_agent_info().id; - - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", this %1%, agent=%2%, log_dir=%3%") - % this % plugin.get_agent() % log_dir; - } else { - BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": BBL network plugin not loaded"; } } @@ -132,17 +126,12 @@ NetworkAgent::NetworkAgent(std::shared_ptr cloud_agent, : m_cloud_agent(std::move(cloud_agent)) , m_printer_agent(std::move(printer_agent)) { - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format( - ", sub-agent composition mode: cloud=%1%, printer=%2%") - % (m_cloud_agent ? "yes" : "no") - % (m_printer_agent ? "yes" : "no (will be set when printer selected)"); } NetworkAgent::~NetworkAgent() { // Note: We don't destroy the agent here anymore since it's managed by BBLNetworkPlugin singleton // The singleton manages the agent lifecycle - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", this %1%") % this; } void NetworkAgent::set_printer_agent(std::shared_ptr printer_agent) @@ -158,7 +147,6 @@ void NetworkAgent::set_printer_agent(std::shared_ptr printer_agen std::lock_guard lock(m_agent_mutex); if (!printer_agent) { - BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": null printer agent provided"; return; } @@ -180,8 +168,6 @@ void NetworkAgent::set_printer_agent(std::shared_ptr printer_agen // critical section duration. The local shared_ptr copy ensures the agent // cannot be destroyed while we're using it. apply_printer_callbacks(new_printer_agent, callbacks); - - BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": agent switched successfully"; } void* NetworkAgent::get_network_agent() diff --git a/src/slic3r/Utils/NetworkAgentFactory.cpp b/src/slic3r/Utils/NetworkAgentFactory.cpp index 0f51d43e62..faafe136b2 100644 --- a/src/slic3r/Utils/NetworkAgentFactory.cpp +++ b/src/slic3r/Utils/NetworkAgentFactory.cpp @@ -34,16 +34,12 @@ bool NetworkAgentFactory::register_printer_agent(const std::string& id, const st auto result = agents.emplace(id, PrinterAgentInfo(id, display_name, std::move(factory))); if (result.second) { - BOOST_LOG_TRIVIAL(info) << "Registered printer agent: " << id << " (" << display_name << ")"; - - // Set as default if it's the first agent registered auto& default_id = get_default_agent_id(); if (default_id.empty()) { default_id = id; } return true; } else { - BOOST_LOG_TRIVIAL(warning) << "Printer agent already registered: " << id; return false; } } @@ -106,9 +102,6 @@ void NetworkAgentFactory::set_default_printer_agent_id(const std::string& id) if (agents.find(id) != agents.end()) { get_default_agent_id() = id; - BOOST_LOG_TRIVIAL(info) << "Default printer agent set to: " << id; - } else { - BOOST_LOG_TRIVIAL(warning) << "Cannot set default to unregistered agent: " << id; } } @@ -170,7 +163,6 @@ void NetworkAgentFactory::register_all_agents() }); } - BOOST_LOG_TRIVIAL(info) << "Registered " << get_printer_agents().size() << " printer agents"; } std::unique_ptr create_agent_from_config(const std::string& log_dir, AppConfig* app_config) @@ -189,9 +181,7 @@ std::unique_ptr create_agent_from_config(const std::string& log_di CloudAgentProvider provider = use_orca_cloud ? CloudAgentProvider::Orca : CloudAgentProvider::BBL; auto cloud_agent = NetworkAgentFactory::create_cloud_agent(provider, log_dir); - // Fall back to Orca if BBL plugin not available if (!cloud_agent && provider == CloudAgentProvider::BBL) { - BOOST_LOG_TRIVIAL(warning) << "BBL plugin not loaded, falling back to Orca cloud agent"; cloud_agent = NetworkAgentFactory::create_cloud_agent(CloudAgentProvider::Orca, log_dir); } @@ -206,7 +196,6 @@ std::unique_ptr create_agent_from_config(const std::string& log_di // We will create the printer agent later when the printer is selected, so we pass nullptr for the printer agent here. auto agent = NetworkAgentFactory::create_from_agents(std::move(cloud_agent), nullptr); - // Configure URL overrides for Orca cloud if (agent && app_config && use_orca_cloud) { auto* orca_cloud = dynamic_cast(agent->get_cloud_agent().get()); if (orca_cloud) { @@ -214,7 +203,6 @@ std::unique_ptr create_agent_from_config(const std::string& log_di } } - BOOST_LOG_TRIVIAL(info) << "Created NetworkAgent with cloud agent"; return agent; } diff --git a/src/slic3r/Utils/OrcaCloudServiceAgent.cpp b/src/slic3r/Utils/OrcaCloudServiceAgent.cpp index 6ed3bab66c..da518f1e10 100644 --- a/src/slic3r/Utils/OrcaCloudServiceAgent.cpp +++ b/src/slic3r/Utils/OrcaCloudServiceAgent.cpp @@ -332,7 +332,6 @@ OrcaCloudServiceAgent::OrcaCloudServiceAgent(std::string log_dir) update_redirect_uri(); regenerate_pkce(); compute_fallback_path(); - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Constructor - log_dir=" << this->log_dir; } OrcaCloudServiceAgent::~OrcaCloudServiceAgent() @@ -348,19 +347,15 @@ void OrcaCloudServiceAgent::configure_urls(AppConfig* app_config) // Read token storage preference m_use_encrypted_token_file = app_config->get_bool(SETTING_USE_ENCRYPTED_TOKEN_FILE); - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: token storage mode set to " - << (m_use_encrypted_token_file ? "encrypted file" : "System Keychain"); std::string api_url = app_config->get(CONFIG_ORCA_API_URL); if (!api_url.empty()) { api_base_url = api_url; - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Using custom API URL: " << api_base_url; } std::string auth_url = app_config->get(CONFIG_ORCA_AUTH_URL); if (!auth_url.empty()) { auth_base_url = auth_url; - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Using custom Auth URL: " << auth_base_url; } std::string pub_key = app_config->get(CONFIG_ORCA_PUB_KEY); @@ -382,8 +377,6 @@ void OrcaCloudServiceAgent::set_auth_base_url(const std::string& url) void OrcaCloudServiceAgent::set_use_encrypted_token_file(bool use) { m_use_encrypted_token_file = use; - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: token storage mode set to " - << (m_use_encrypted_token_file ? "encrypted file" : "System Keychain"); } bool OrcaCloudServiceAgent::get_use_encrypted_token_file() const @@ -397,7 +390,6 @@ bool OrcaCloudServiceAgent::get_use_encrypted_token_file() const int OrcaCloudServiceAgent::init_log() { - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: init_log called"; return BAMBU_NETWORK_SUCCESS; } @@ -407,35 +399,30 @@ int OrcaCloudServiceAgent::set_config_dir(std::string cfg_dir) wxFileName fallback(wxString::FromUTF8(cfg_dir.c_str()), "orca_refresh_token.sec"); fallback.Normalize(); refresh_fallback_path = fallback.GetFullPath().ToStdString(); - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: set_config_dir - " << cfg_dir; return BAMBU_NETWORK_SUCCESS; } int OrcaCloudServiceAgent::set_cert_file(std::string folder, std::string filename) { // Not used by OrcaCloudServiceAgent (OAuth doesn't need client certs) - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: set_cert_file called (unused) - " << folder << "/" << filename; + (void) folder; + (void) filename; return BAMBU_NETWORK_SUCCESS; } int OrcaCloudServiceAgent::set_country_code(std::string code) { country_code = code; - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: set_country_code - " << code; return BAMBU_NETWORK_SUCCESS; } int OrcaCloudServiceAgent::start() { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: start called"; - - // Regenerate PKCE bundle for fresh login attempts regenerate_pkce(); // Attempt silent sign-in from stored refresh token std::string stored_refresh; if (load_refresh_token(stored_refresh) && !stored_refresh.empty()) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Found stored refresh token, attempting silent sign-in"; refresh_now(stored_refresh, "refresh token", false); } @@ -456,7 +443,6 @@ bool OrcaCloudServiceAgent::exchange_auth_code(const std::string& auth_code, con } std::string url = auth_base_url + auth_constants::TOKEN_PATH; - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: exchanging auth code for tokens"; std::string redirect_uri; std::string code_verifier; @@ -533,8 +519,6 @@ bool OrcaCloudServiceAgent::exchange_auth_code(const std::string& auth_code, con int OrcaCloudServiceAgent::change_user(std::string user_info) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: change_user invoked"; - try { std::stringstream ss(user_info); pt::ptree tree; @@ -547,7 +531,6 @@ int OrcaCloudServiceAgent::change_user(std::string user_info) // Check if this is a WebView login message (PKCE flow completion) std::string command = tree.get("command", ""); if (command == "user_login") { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Detected WebView login message"; auto data_opt = tree.get_child_optional("data"); if (!data_opt) { @@ -562,7 +545,6 @@ int OrcaCloudServiceAgent::change_user(std::string user_info) // Check for auth code (PKCE authorization code flow) std::string auth_code = read_str(data, "code"); if (!auth_code.empty()) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Detected auth code, exchanging for tokens"; std::string session_payload; if (!exchange_auth_code(auth_code, state, session_payload)) { invoke_user_login_callback(0, false); @@ -652,7 +634,6 @@ int OrcaCloudServiceAgent::change_user(std::string user_info) return BAMBU_NETWORK_ERR_INVALID_HANDLE; } - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Orca cloud login successful - user_id=" << user_id; bool success = set_user_session(access_token, user_id, username, name, nickname, avatar, refresh_token); if (success) { invoke_user_login_callback(1, true); @@ -662,8 +643,6 @@ int OrcaCloudServiceAgent::change_user(std::string user_info) } else { invoke_user_login_callback(0, false); } - BOOST_LOG_TRIVIAL(info) << "[auth] event=login result=" << (success ? "success" : "failure") - << " source=session user_id=" << user_id; return success ? BAMBU_NETWORK_SUCCESS : BAMBU_NETWORK_ERR_INVALID_HANDLE; } @@ -686,7 +665,6 @@ bool OrcaCloudServiceAgent::is_user_login() int OrcaCloudServiceAgent::user_logout(bool request) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: user_logout - request=" << request; // Send logout request to backend if requested if (request) { @@ -719,14 +697,8 @@ int OrcaCloudServiceAgent::user_logout(bool request) } } - // Clear session clear_session(); - - // Invoke callback invoke_user_login_callback(0, false); - - BOOST_LOG_TRIVIAL(info) << "[auth] event=logout result=success request=" << request; - return BAMBU_NETWORK_SUCCESS; } @@ -871,8 +843,6 @@ bool OrcaCloudServiceAgent::ensure_token_fresh(const std::string& reason) int OrcaCloudServiceAgent::connect_server() { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: connect_server"; - std::string response; unsigned int http_code = 0; int result = http_get(ORCA_HEALTH_PATH, &response, &http_code); @@ -884,8 +854,6 @@ int OrcaCloudServiceAgent::connect_server() } invoke_server_connected_callback(connected ? 0 : -1, http_code); - - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: connect_server result=" << (connected ? "connected" : "failed"); return connected ? BAMBU_NETWORK_SUCCESS : BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED; } @@ -902,25 +870,25 @@ int OrcaCloudServiceAgent::refresh_connection() int OrcaCloudServiceAgent::start_subscribe(std::string module) { - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: start_subscribe - " << module << " (stub)"; + (void) module; return BAMBU_NETWORK_SUCCESS; } int OrcaCloudServiceAgent::stop_subscribe(std::string module) { - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: stop_subscribe - " << module << " (stub)"; + (void) module; return BAMBU_NETWORK_SUCCESS; } int OrcaCloudServiceAgent::add_subscribe(std::vector dev_list) { - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: add_subscribe (stub)"; + (void) dev_list; return BAMBU_NETWORK_SUCCESS; } int OrcaCloudServiceAgent::del_subscribe(std::vector dev_list) { - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: del_subscribe (stub)"; + (void) dev_list; return BAMBU_NETWORK_SUCCESS; } @@ -936,8 +904,6 @@ void OrcaCloudServiceAgent::enable_multi_machine(bool enable) int OrcaCloudServiceAgent::get_user_presets(std::map>* user_presets) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: get_user_presets"; - if (!user_presets) return BAMBU_NETWORK_ERR_INVALID_HANDLE; if (!is_user_login()) { @@ -995,8 +961,6 @@ int OrcaCloudServiceAgent::get_user_presets(std::map* values_map, unsigned int* http_code) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: request_setting_id - " << name; - std::string new_id = generate_uuid(name); if (new_id.empty()) { BOOST_LOG_TRIVIAL(error) << "OrcaCloudServiceAgent: request_setting_id failed - name is empty"; @@ -1020,12 +984,9 @@ std::string OrcaCloudServiceAgent::request_setting_id(std::string name, std::map if (http_code) *http_code = result.http_code; if (result.success) { - // Return new_updated_at via values_map so caller can store it in Preset::updated_time if (values_map && !result.new_updated_at.empty()) { (*values_map)[IOT_JSON_KEY_UPDATED_TIME] = result.new_updated_at; } - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Created preset - setting_id=" << new_id - << ", new_updated_at=" << result.new_updated_at; return new_id; } @@ -1035,9 +996,8 @@ std::string OrcaCloudServiceAgent::request_setting_id(std::string name, std::map int OrcaCloudServiceAgent::put_setting(std::string setting_id, std::string name, std::map* values_map, unsigned int* http_code) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: put_setting - setting_id=" << setting_id << ", name=" << name; - - // Extract original_updated_at for Optimistic Concurrency Control (per spec section 5.2) + // Extract original_updated_at for Optimistic Concurrency Control + // If present, server will verify version before update. If absent, treated as insert. // If present, server will verify version before update. If absent, treated as insert. std::string original_updated_at; if (values_map) { @@ -1066,8 +1026,6 @@ int OrcaCloudServiceAgent::put_setting(std::string setting_id, std::string name, if (values_map && !result.new_updated_at.empty()) { (*values_map)[IOT_JSON_KEY_UPDATED_TIME] = result.new_updated_at; } - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: Updated preset - setting_id=" << setting_id - << ", new_updated_at=" << result.new_updated_at; return BAMBU_NETWORK_SUCCESS; } @@ -1091,8 +1049,7 @@ int OrcaCloudServiceAgent::get_setting_list(std::string bundle_version, Progress int OrcaCloudServiceAgent::get_setting_list2(std::string bundle_version, CheckFn chk_fn, ProgressFn pro_fn, WasCancelledFn cancel_fn) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: get_setting_list2 - bundle_version=" << bundle_version; - + (void) bundle_version; bool success = false; int error_code = 0; @@ -1103,7 +1060,6 @@ int OrcaCloudServiceAgent::get_setting_list2(std::string bundle_version, CheckFn for (const auto& upsert : resp.upserts) { if (cancel_fn && cancel_fn()) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: get_setting_list2 cancelled"; cancelled = true; break; } @@ -1144,7 +1100,6 @@ int OrcaCloudServiceAgent::get_setting_list2(std::string bundle_version, CheckFn if (!cancelled) { for (const auto& deleted_id : resp.deletes) { if (cancel_fn && cancel_fn()) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: get_setting_list2 cancelled"; cancelled = true; break; } @@ -1190,8 +1145,6 @@ int OrcaCloudServiceAgent::get_setting_list2(std::string bundle_version, CheckFn int OrcaCloudServiceAgent::delete_setting(std::string setting_id) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: delete_setting - " << setting_id; - std::string path = std::string(ORCA_PROFILES_PATH) + "/" + setting_id; std::string response; unsigned int http_code = 0; @@ -1212,8 +1165,6 @@ int OrcaCloudServiceAgent::sync_pull( std::function on_success, std::function on_error) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: sync_pull"; - std::string path = ORCA_SYNC_PULL_PATH; if (!sync_state.last_sync_timestamp.empty()) { path += "?cursor=" + sync_state.last_sync_timestamp; @@ -1238,9 +1189,7 @@ int OrcaCloudServiceAgent::sync_pull( return BAMBU_NETWORK_ERR_GET_SETTING_LIST_FAILED; } - // Handle 304 Not Modified - no changes if (http_code == 304) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: sync_pull - no changes (304)"; if (on_success) { SyncPullResponse empty_response; on_success(empty_response); @@ -1289,8 +1238,6 @@ SyncPushResult OrcaCloudServiceAgent::sync_push( const nlohmann::json& content, const std::string& original_updated_at) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: sync_push - " << profile_id; - SyncPushResult result; result.success = false; result.http_code = 0; @@ -1429,15 +1376,11 @@ void OrcaCloudServiceAgent::regenerate_pkce() if (pkce_bundle.redirect.empty()) { pkce_bundle.redirect = "http://localhost:" + std::to_string(pkce_bundle.loopback_port) + auth_constants::LOOPBACK_PATH; } - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: regenerated PKCE bundle"; } void OrcaCloudServiceAgent::update_redirect_uri() { int selected_port = choose_loopback_port(); - if (selected_port != pkce_bundle.loopback_port) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: loopback port changed to " << selected_port; - } pkce_bundle.loopback_port = selected_port; pkce_bundle.redirect = "http://localhost:" + std::to_string(selected_port) + auth_constants::LOOPBACK_PATH; } @@ -1512,15 +1455,12 @@ void OrcaCloudServiceAgent::persist_refresh_token(const std::string& token) } } - if (stored) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: refresh token persisted successfully"; - } + (void) stored; } bool OrcaCloudServiceAgent::load_refresh_token(std::string& out_token) { out_token.clear(); - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: load_refresh_token called"; if (m_use_encrypted_token_file) { // Load from encrypted file only @@ -1555,11 +1495,8 @@ bool OrcaCloudServiceAgent::load_refresh_token(std::string& out_token) if (integrity_ok && aes256gcm_decrypt(encoded_payload, key, plain) && !plain.empty()) { out_token = plain; - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: loaded refresh token from encrypted file"; - // Upgrade legacy payloads to signed format if (payload.rfind("v2:", 0) != 0) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: upgrading legacy token format to v2"; persist_refresh_token(out_token); } return true; @@ -1567,23 +1504,16 @@ bool OrcaCloudServiceAgent::load_refresh_token(std::string& out_token) } } } else { - // Load from wxSecretStore only wxSecretStore store = wxSecretStore::GetDefault(); if (store.IsOk()) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: System Keychain is available, attempting load"; wxString username; wxSecretValue secret; if (store.Load(SECRET_STORE_SERVICE, username, secret) && secret.IsOk()) { out_token.assign(static_cast(secret.GetData()), secret.GetSize()); if (!out_token.empty()) { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: loaded refresh token from System Keychain"; return true; } - } else { - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: System Keychain load failed or data is invalid"; } - } else { - BOOST_LOG_TRIVIAL(warning) << "OrcaCloudServiceAgent: System Keychain is NOT available"; } } @@ -1656,14 +1586,8 @@ bool OrcaCloudServiceAgent::refresh_now(const std::string& refresh_token, const } auto worker = [this, refresh_token, reason]() { - const std::string req_id = generate_state_token(); - BOOST_LOG_TRIVIAL(info) << "[auth] event=refresh_start source=" << reason << " rid=" << req_id; + (void) reason; bool ok = refresh_session_with_token(refresh_token); - if (ok) { - BOOST_LOG_TRIVIAL(info) << "[auth] event=refresh_complete result=success source=" << reason << " rid=" << req_id; - } else { - BOOST_LOG_TRIVIAL(warning) << "[auth] event=refresh_complete result=failure source=" << reason << " rid=" << req_id; - } refresh_running.store(false); return ok; }; @@ -1712,10 +1636,7 @@ bool OrcaCloudServiceAgent::refresh_if_expiring(std::chrono::seconds skew, const bool OrcaCloudServiceAgent::refresh_session_with_token(const std::string& refresh_token) { std::string body = "{\"refresh_token\":\"" + refresh_token + "\"}"; - std::string url = auth_base_url + auth_constants::TOKEN_PATH + "?grant_type=refresh_token"; - BOOST_LOG_TRIVIAL(debug) << "OrcaCloudServiceAgent: refresh request - token_length=" << refresh_token.size() << ", url=" << url; - std::string response; unsigned int http_code = 0; if (!http_post_token(body, &response, &http_code, url) || http_code >= 400) { @@ -1764,7 +1685,6 @@ bool OrcaCloudServiceAgent::refresh_session_with_token(const std::string& refres return false; } - BOOST_LOG_TRIVIAL(info) << "OrcaCloudServiceAgent: token refresh successful - user_id=" << user_id; bool success = set_user_session(access_token, user_id, username, name, nickname, avatar, new_refresh_token); if (success) { invoke_user_login_callback(0, true); @@ -1774,8 +1694,6 @@ bool OrcaCloudServiceAgent::refresh_session_with_token(const std::string& refres } else { invoke_user_login_callback(0, false); } - BOOST_LOG_TRIVIAL(info) << "[auth] event=token_refresh result=" << (success ? "success" : "failure") - << " user_id=" << user_id; return success; } catch (const std::exception& e) { diff --git a/src/slic3r/Utils/QidiPrinterAgent.cpp b/src/slic3r/Utils/QidiPrinterAgent.cpp index 5f16ab9339..b5dce54c3c 100644 --- a/src/slic3r/Utils/QidiPrinterAgent.cpp +++ b/src/slic3r/Utils/QidiPrinterAgent.cpp @@ -141,9 +141,6 @@ void QidiPrinterAgent::fetch_filament_info(std::string dev_id) // Call the parser to populate DevFilaSystem DevFilaSystemParser::ParseV1_0(print_json, obj, obj->GetFilaSystem(), false); - - BOOST_LOG_TRIVIAL(info) << "QidiPrinterAgent::fetch_filament_info: Populated DevFilaSystem with " - << box_count << " AMS units"; } bool QidiPrinterAgent::fetch_slot_info(const std::string& base_url,