diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee5c2e7cf4..4d0ea05baa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -115,9 +115,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/msw/Snapmaker_Orca.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.manifest @ONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev-utils/platform/osx/Info.plist.in ${CMAKE_CURRENT_BINARY_DIR}/Info.plist @ONLY) if (WIN32) - add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp) + add_library(Snapmaker_Orca SHARED Snapmaker_Orca.cpp Snapmaker_Orca.hpp dev-utils/BaseException.cpp dev-utils/BaseException.h dev-utils/StackWalker.cpp dev-utils/StackWalker.h sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp) else () - add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp) + add_executable(Snapmaker_Orca Snapmaker_Orca.cpp Snapmaker_Orca.hpp sentry_wrapper/SentryWrapper.hpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.hpp bury_cfg/bury_point.cpp) endif () if (MINGW) @@ -181,7 +181,7 @@ if (WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -municode") endif() - add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc) + add_executable(Snapmaker_Orca_app_gui WIN32 Snapmaker_Orca_app_msvc.cpp sentry_wrapper/SentryWrapper.cpp bury_cfg/bury_point.cpp ${CMAKE_CURRENT_BINARY_DIR}/Snapmaker_Orca.rc) # Generate debug symbols even in release mode. if(MSVC) target_link_options(Snapmaker_Orca_app_gui PUBLIC "$<$:/DEBUG>") diff --git a/src/Snapmaker_Orca.cpp b/src/Snapmaker_Orca.cpp index 5f50d8aca3..b7e72214f0 100644 --- a/src/Snapmaker_Orca.cpp +++ b/src/Snapmaker_Orca.cpp @@ -6296,9 +6296,12 @@ extern "C" { int main(int argc, char **argv) { initSentry(); - + std::string softStartTime = BP_SOFT_START_TIME+ ":" + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softStartTime, BP_START_SOFT); auto res = CLI().run(argc, argv); + std::string softEndTime = BP_SOFT_END_TIME + ":" + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return res; diff --git a/src/Snapmaker_Orca_app_msvc.cpp b/src/Snapmaker_Orca_app_msvc.cpp index fe77bf37ea..99660b8e94 100644 --- a/src/Snapmaker_Orca_app_msvc.cpp +++ b/src/Snapmaker_Orca_app_msvc.cpp @@ -227,6 +227,8 @@ int wmain(int argc, wchar_t** argv) _set_error_mode(_OUT_TO_MSGBOX); initSentry(); + std::string softStartTime = BP_SOFT_START_TIME + std::string(":") + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softStartTime, BP_START_SOFT); std::vector argv_extended; argv_extended.emplace_back(argv[0]); @@ -292,6 +294,8 @@ int wmain(int argc, wchar_t** argv) HINSTANCE hInstance_Slic3r = LoadLibraryExW(path_to_slic3r, nullptr, 0); if (hInstance_Slic3r == nullptr) { printf("Snapmaker_Orca.dll was not loaded, error=%d\n", GetLastError()); + std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return -1; } @@ -308,12 +312,16 @@ int wmain(int argc, wchar_t** argv) ); if (Snapmaker_Orca_main == nullptr) { printf("could not locate the function Snapmaker_Orca_main in Snapmaker_Orca.dll\n"); + std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return -1; } // argc minus the trailing nullptr of the argv auto res = Snapmaker_Orca_main((int) argv_extended.size() - 1, argv_extended.data()); + std::string softEndTime = BP_SOFT_END_TIME + std::string(":") + get_timestamp_seconds(); + sentryReportLog(SENTRY_LOG_TRACE, softEndTime, BP_START_SOFT); exitSentry(); return res; } diff --git a/src/bury_cfg/bury_point.cpp b/src/bury_cfg/bury_point.cpp new file mode 100644 index 0000000000..549ff77bc1 --- /dev/null +++ b/src/bury_cfg/bury_point.cpp @@ -0,0 +1,18 @@ +#include "bury_point.hpp" +#include +#include +#include +#include + +std::string get_timestamp_seconds() +{ + auto now = std::chrono::system_clock::now(); + + auto timestamp = std::chrono::duration_cast(now.time_since_epoch()).count(); + + std::ostringstream oss; + oss << timestamp; + auto strTime = oss.str(); + + return strTime; +} \ No newline at end of file diff --git a/src/bury_cfg/bury_point.hpp b/src/bury_cfg/bury_point.hpp new file mode 100644 index 0000000000..e0aaef18a8 --- /dev/null +++ b/src/bury_cfg/bury_point.hpp @@ -0,0 +1,39 @@ +#ifndef _BURY_POINT_hpp_ +#define _BURY_POINT_hpp_ +#include +#include + +#define BP_START_SOFT "bury_point_start_soft" +#define BP_SOFT_START_TIME "soft_start_time" +#define BP_SOFT_END_TIME "soft_end_time" + +#define BP_DEIVCE_CONNECT "bury_point_device_connect" +#define BP_CONNECT_DEVICE_ID "device_id" +#define BP_CONNECT_NET_TYPE "net_type" + +#define BP_LOGIN "bury_point_login" +#define BP_LOGIN_USER_ID "user_id" +#define BP_LOGIN_HTTP_CODE "http_code" + +#define BP_VIDEO_START "bury_point_video_start" +#define BP_VIDEO_STATUS "video_status" + +#define BP_DEVICE_ERROR "bury_point_device_error" +#define BP_DEVICE_ERROR_STATUS "error_status" + +#define BP_UPLOAD "bury_point_upload" + +#define BP_UPLOAD_AND_PRINT "bury_point_upload_and_print" + +#define BP_COLOR_PAINTING "bury_point_color_painting" + +#define BP_VIDEO_ABNORMAL "bury_point_video_abnormal" +//webview bury point + + + + static bool isAgreeSlice = false; + extern std::string get_timestamp_seconds(); + + +#endif \ No newline at end of file diff --git a/src/sentry_wrapper/SentryWrapper.hpp b/src/sentry_wrapper/SentryWrapper.hpp index 29de368b0e..c3302dbc90 100644 --- a/src/sentry_wrapper/SentryWrapper.hpp +++ b/src/sentry_wrapper/SentryWrapper.hpp @@ -2,6 +2,7 @@ #define slic3r_SentryWrapper_hpp_ #include +#include "bury_cfg/bury_point.hpp" namespace Slic3r { diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index 762b371778..29b58b5457 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -34,6 +34,7 @@ #include +#include "sentry_wrapper/SentryWrapper.hpp" namespace Slic3r { namespace GUI { //BBS: GUI refactor: to support top layout @@ -350,6 +351,8 @@ bool GLGizmosManager::open_gizmo(EType type) #ifdef __WXOSX__ m_parent.post_event(SimpleEvent(wxEVT_PAINT)); #endif + if (EType::MmSegmentation == type) + sentryReportLog(SENTRY_LOG_TRACE, "", BP_COLOR_PAINTING); return true; } return false; diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index deeb64cae0..b1761b90dd 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -3,6 +3,7 @@ #include #include +#include "sentry_wrapper/SentryWrapper.hpp" #include #include #include @@ -152,6 +153,7 @@ void PrintHostSendDialog::init() auto* btn_ok = add_button(wxID_OK, true, _L("Upload")); btn_ok->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { + sentryReportLog(SENTRY_LOG_TRACE, "", BP_UPLOAD); if (validate_path(txt_filename->GetValue())) { post_upload_action = PrintHostPostUploadAction::None; EndDialog(wxID_OK); @@ -172,6 +174,7 @@ void PrintHostSendDialog::init() if (post_actions.has(PrintHostPostUploadAction::StartPrint)) { auto* btn_print = add_button(wxID_YES, false, _L("Upload and Print")); btn_print->Bind(wxEVT_BUTTON, [this, validate_path](wxCommandEvent&) { + sentryReportLog(SENTRY_LOG_TRACE, "", BP_UPLOAD_AND_PRINT); if (validate_path(txt_filename->GetValue())) { post_upload_action = PrintHostPostUploadAction::StartPrint; EndDialog(wxID_OK); diff --git a/src/slic3r/GUI/WebSMUserLoginDialog.cpp b/src/slic3r/GUI/WebSMUserLoginDialog.cpp index 1df1e1efd0..2092f0d812 100644 --- a/src/slic3r/GUI/WebSMUserLoginDialog.cpp +++ b/src/slic3r/GUI/WebSMUserLoginDialog.cpp @@ -25,6 +25,7 @@ #include #include +#include "sentry_wrapper/SentryWrapper.hpp" using namespace std; using namespace nlohmann; @@ -198,11 +199,13 @@ void SMUserLogin::OnNavigationRequest(wxWebViewEvent &evt) http.header("Authorization",token); http.on_complete([&](std::string body, unsigned status) { if (status == 200) { + std::string user_id = ""; json response = json::parse(body); if (response.count("data")) { json data = response["data"]; if (data.count("id")) { wxGetApp().sm_get_userinfo()->set_user_id(std::to_string(data["id"].get())); + user_id = std::to_string(data["id"].get()); } if (data.count("nickname")) { wxGetApp().sm_get_userinfo()->set_user_name(data["nickname"].get()); @@ -214,13 +217,15 @@ void SMUserLogin::OnNavigationRequest(wxWebViewEvent &evt) wxGetApp().sm_get_userinfo()->set_user_account(data["account"].get()); } } - + string userInfo = BP_LOGIN_USER_ID + std::string(":") + user_id; + sentryReportLog(SENTRY_LOG_TRACE, userInfo, BP_LOGIN); wxGetApp().sm_get_userinfo()->set_user_token(token); wxGetApp().sm_get_userinfo()->set_user_login(true); } }) .on_error([&](std::string body, std::string error, unsigned status) { - + std::string http_code = BP_LOGIN_HTTP_CODE + string(":") + std::to_string(status); + sentryReportLog(SENTRY_LOG_TRACE, http_code, BP_LOGIN); }) .perform_sync(); }); diff --git a/src/slic3r/Utils/MoonRaker.cpp b/src/slic3r/Utils/MoonRaker.cpp index bc6fef75df..b8d4ade264 100644 --- a/src/slic3r/Utils/MoonRaker.cpp +++ b/src/slic3r/Utils/MoonRaker.cpp @@ -28,6 +28,7 @@ #include "slic3r/GUI/WebPreprintDialog.hpp" #include "slic3r/GUI/SSWCP.hpp" +#include "sentry_wrapper/SentryWrapper.hpp" #ifdef _WIN32 #include #include @@ -2287,6 +2288,7 @@ void Moonraker_Mqtt::async_camera_start(const std::string& domain, int interval, callback) { BOOST_LOG_TRIVIAL(error) << "[Moonraker_Mqtt] 发送启动摄像头监控请求失败"; wcp_loger.add_log("发送启动摄像头监控请求失败", false, "", "Moonraker_Mqtt", "error"); + sentryReportLog(SENTRY_LOG_TRACE, "open video cmd error", BP_VIDEO_ABNORMAL); callback(json::value_t::null); } } @@ -2336,6 +2338,7 @@ void Moonraker_Mqtt::async_canmera_stop(const std::string& domain, std::function callback) { BOOST_LOG_TRIVIAL(error) << "[Moonraker_Mqtt] 发送停止摄像头监控请求失败"; wcp_loger.add_log("发送停止摄像头监控请求失败", false, "", "Moonraker_Mqtt", "error"); + sentryReportLog(SENTRY_LOG_TRACE, "stop video cmd error", BP_VIDEO_ABNORMAL); callback(json::value_t::null); } }