From 9380880b587b3f57681ef6fc38b7e7b6ac22065b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ben=20Gr=C3=A4f?= Date: Fri, 27 Jul 2018 21:21:33 +0200 Subject: [PATCH] Fix getClientLogs function and log viewer on dashboard --- index.html | 8 ++++---- src/cc/Service.cpp | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 934a6d3f..29ebd37d 100644 --- a/index.html +++ b/index.html @@ -416,10 +416,10 @@ type: "GET", url: "/admin/getClientLog?clientId=" + clientId, dataType:"json", - success: function(jsonClientLog) { + success: function(data) { var htmlContent = "
" + ""+ - "" + + "" + "
"; $('#minerLog').find('.modal-body').html(htmlContent); @@ -442,8 +442,8 @@ type: "GET", url: "/admin/getClientLog?clientId=" + clientId, dataType:"json", - success: function(jsonClientLog) { - $('#log').val(JSON.stringify(jsonClientLog,undefined, 2)); + success: function(data) { + $('#log').val(data.client_log); }, error: function (data) { setError('Unable to fetch ' + clientId + ' log. - Please make sure it is enabled on the miner!'); diff --git a/src/cc/Service.cpp b/src/cc/Service.cpp index 6c9e317b..a12d44be 100644 --- a/src/cc/Service.cpp +++ b/src/cc/Service.cpp @@ -288,9 +288,8 @@ unsigned Service::getClientLog(const std::string& clientId, std::string& resp) data << m_row.c_str() << std::endl; } - LOG_INFO("LOG: %s", data.str().c_str()); - - respDocument.AddMember("client_log", rapidjson::StringRef(data.str().c_str()), allocator); + std::string log = data.str(); + respDocument.AddMember("client_log", rapidjson::StringRef(log.c_str()), allocator); rapidjson::StringBuffer buffer(0, 4096); rapidjson::Writer writer(buffer);