mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Logger output in WebUI (#337)
* expanding logging result array of JSON request * matching web logging output to console
This commit is contained in:
parent
cb7e2ff1c0
commit
8aa0fbaa1e
@ -34,9 +34,21 @@ $(document).ready(function() {
|
|||||||
messages = (event.response.result.messages);
|
messages = (event.response.result.messages);
|
||||||
for(var idx=0; idx<messages.length; idx++)
|
for(var idx=0; idx<messages.length; idx++)
|
||||||
{
|
{
|
||||||
msg = messages[idx];
|
app_name = messages[idx].appName;
|
||||||
$("#logmessages").html($("#logmessages").html()+"\n <code>"+msg+"</code>");
|
logger_name = messages[idx].loggerName;
|
||||||
|
function_ = messages[idx].function;
|
||||||
|
line = messages[idx].line;
|
||||||
|
file_name = messages[idx].fileName;
|
||||||
|
msg = messages[idx].message;
|
||||||
|
level_string = messages[idx].levelString;
|
||||||
|
|
||||||
|
var debug = "";
|
||||||
|
|
||||||
|
if(level_string == "DEBUG") {
|
||||||
|
debug = "<"+file_name+":"+line+":"+function_+"()> ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#logmessages").html($("#logmessages").html()+"\n <code>"+"["+app_name+" "+logger_name+"] <"+level_string+"> "+debug+msg+"</code>");
|
||||||
}
|
}
|
||||||
if($("#btn_autoscroll").hasClass('btn-success')){
|
if($("#btn_autoscroll").hasClass('btn-success')){
|
||||||
$('#logmessages').stop().animate({
|
$('#logmessages').stop().animate({
|
||||||
|
@ -1257,8 +1257,8 @@ void JsonClientConnection::handleLoggingCommand(const QJsonObject& message, cons
|
|||||||
|
|
||||||
void JsonClientConnection::incommingLogMessage(Logger::T_LOG_MESSAGE msg)
|
void JsonClientConnection::incommingLogMessage(Logger::T_LOG_MESSAGE msg)
|
||||||
{
|
{
|
||||||
QJsonObject result;
|
QJsonObject result, message;
|
||||||
QJsonArray messages;
|
QJsonArray messageArray;
|
||||||
|
|
||||||
if (!_streaming_logging_activated)
|
if (!_streaming_logging_activated)
|
||||||
{
|
{
|
||||||
@ -1266,24 +1266,37 @@ void JsonClientConnection::incommingLogMessage(Logger::T_LOG_MESSAGE msg)
|
|||||||
QVector<Logger::T_LOG_MESSAGE>* logBuffer = LoggerManager::getInstance()->getLogMessageBuffer();
|
QVector<Logger::T_LOG_MESSAGE>* logBuffer = LoggerManager::getInstance()->getLogMessageBuffer();
|
||||||
for(int i=0; i<logBuffer->length(); i++)
|
for(int i=0; i<logBuffer->length(); i++)
|
||||||
{
|
{
|
||||||
//std::cout << "------- " << logBuffer->at(i).message.toStdString() << std::endl;
|
message["appName"] = logBuffer->at(i).appName;
|
||||||
messages.append(logBuffer->at(i).message);
|
message["loggerName"] = logBuffer->at(i).loggerName;
|
||||||
|
message["function"] = logBuffer->at(i).function;
|
||||||
|
message["line"] = QString::number(logBuffer->at(i).line);
|
||||||
|
message["fileName"] = logBuffer->at(i).fileName;
|
||||||
|
message["message"] = logBuffer->at(i).message;
|
||||||
|
message["levelString"] = logBuffer->at(i).levelString;
|
||||||
|
|
||||||
|
messageArray.append(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//std::cout << "------- " << msg.message.toStdString() << std::endl;
|
message["appName"] = msg.appName;
|
||||||
messages.append(msg.message);
|
message["loggerName"] = msg.loggerName;
|
||||||
|
message["function"] = msg.function;
|
||||||
|
message["line"] = QString::number(msg.line);
|
||||||
|
message["fileName"] = msg.fileName;
|
||||||
|
message["message"] = msg.message;
|
||||||
|
message["levelString"] = msg.levelString;
|
||||||
|
|
||||||
|
messageArray.append(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
result["messages"] = messages;
|
result.insert("messages", messageArray);
|
||||||
_streaming_logging_reply["result"] = result;
|
_streaming_logging_reply["result"] = result;
|
||||||
|
|
||||||
// send the result
|
// send the result
|
||||||
sendMessage(_streaming_logging_reply);
|
sendMessage(_streaming_logging_reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JsonClientConnection::handleNotImplemented()
|
void JsonClientConnection::handleNotImplemented()
|
||||||
{
|
{
|
||||||
sendErrorReply("Command not implemented");
|
sendErrorReply("Command not implemented");
|
||||||
|
Loading…
Reference in New Issue
Block a user