mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-31 13:57:07 +00:00
Add: wcp_sentry_upload_api (#51)
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include "MainFrame.hpp"
|
#include "MainFrame.hpp"
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
#include "slic3r/GUI/Tab.hpp"
|
#include "slic3r/GUI/Tab.hpp"
|
||||||
|
#include "sentry_wrapper/SentryWrapper.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
@@ -450,12 +451,49 @@ void SSWCP_Instance::process() {
|
|||||||
sw_SubscribeCacheKey();
|
sw_SubscribeCacheKey();
|
||||||
} else if (m_cmd == "sw_UnsubscribeCacheKeys") {
|
} else if (m_cmd == "sw_UnsubscribeCacheKeys") {
|
||||||
sw_UnsubscribeCacheKeys();
|
sw_UnsubscribeCacheKeys();
|
||||||
|
} else if (m_cmd == "sw_UploadEvent"){
|
||||||
|
sw_UploadEvent();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
handle_general_fail();
|
handle_general_fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SSWCP_Instance::sw_UploadEvent() {
|
||||||
|
try {
|
||||||
|
if(!m_param_data.count("traceId")){
|
||||||
|
handle_general_fail(-1, "param [traceId] required!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!m_param_data.count("level")){
|
||||||
|
handle_general_fail(-1, "param [level] required!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!m_param_data.count("content")){
|
||||||
|
handle_general_fail(-1, "param [content] required!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string traceId = m_param_data["traceId"].get<std::string>();
|
||||||
|
int level = m_param_data["level"].get<int>();
|
||||||
|
|
||||||
|
std::string content = m_param_data["content"].get<std::string>();
|
||||||
|
|
||||||
|
std::string funcModule = m_param_data.count("funcModule") ? m_param_data["funcModule"].get<std::string>() : "";
|
||||||
|
std::string tagKey = m_param_data.count("tagKey") ? m_param_data["tagKey"].get<std::string>() : "";
|
||||||
|
std::string tagValue = m_param_data.count("tagValue") ? m_param_data["tagValue"].get<std::string>() : "";
|
||||||
|
|
||||||
|
|
||||||
|
sentryReportLog(SENTRY_LOG_LEVEL(level), content, funcModule, tagKey, tagValue, traceId);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (std::exception& e) {
|
||||||
|
handle_general_fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SSWCP_Instance::sw_FileLog() {
|
void SSWCP_Instance::sw_FileLog() {
|
||||||
try {
|
try {
|
||||||
std::string level = m_param_data.count("level") ? m_param_data["level"].get<std::string>() : "debug";
|
std::string level = m_param_data.count("level") ? m_param_data["level"].get<std::string>() : "debug";
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ private:
|
|||||||
// orca log
|
// orca log
|
||||||
void sw_FileLog();
|
void sw_FileLog();
|
||||||
|
|
||||||
|
// Sentry
|
||||||
|
void sw_UploadEvent();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// 抽象工具类函数
|
// 抽象工具类函数
|
||||||
|
|||||||
Reference in New Issue
Block a user