mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-05 19:36:45 +02:00
Merge pull request #1029 from overte-org/fix/entity_server_log
Fix long messages in Entity script log
This commit is contained in:
commit
a1e7f7a03e
2 changed files with 20 additions and 5 deletions
|
@ -69,7 +69,6 @@ void EntityScriptServerLogClient::handleEntityServerScriptLogPacket(QSharedPoint
|
|||
QString messageText = QString::fromUtf8(message->readAll());
|
||||
QJsonParseError error;
|
||||
QJsonDocument document = QJsonDocument::fromJson(messageText.toUtf8(), &error);
|
||||
emit receivedNewLogLines(messageText);
|
||||
if(document.isNull()) {
|
||||
qWarning() << "EntityScriptServerLogClient::handleEntityServerScriptLogPacket: Cannot parse JSON: " << error.errorString()
|
||||
<< " Contents: " << messageText;
|
||||
|
@ -98,21 +97,37 @@ void EntityScriptServerLogClient::handleEntityServerScriptLogPacket(QSharedPoint
|
|||
case ScriptMessage::Severity::SEVERITY_INFO:
|
||||
emit scriptEngines->infoEntityMessage(scriptMessage.getMessage(), scriptMessage.getFileName(),
|
||||
scriptMessage.getLineNumber(), scriptMessage.getEntityID(), true);
|
||||
emit receivedNewLogLines("[ INFO {" + scriptMessage.getEntityID().toString() + "} "
|
||||
+ scriptMessage.getFileName() + ":"
|
||||
+ QString::number(scriptMessage.getLineNumber()) + "] "
|
||||
+ scriptMessage.getMessage());
|
||||
break;
|
||||
|
||||
case ScriptMessage::Severity::SEVERITY_PRINT:
|
||||
emit scriptEngines->printedEntityMessage(scriptMessage.getMessage(), scriptMessage.getFileName(),
|
||||
scriptMessage.getLineNumber(), scriptMessage.getEntityID(), true);
|
||||
emit receivedNewLogLines("[ WARNING {" + scriptMessage.getEntityID().toString() + "} "
|
||||
+ scriptMessage.getFileName() + ":"
|
||||
+ QString::number(scriptMessage.getLineNumber()) + "] "
|
||||
+ scriptMessage.getMessage());
|
||||
break;
|
||||
|
||||
case ScriptMessage::Severity::SEVERITY_WARNING:
|
||||
emit scriptEngines->warningEntityMessage(scriptMessage.getMessage(), scriptMessage.getFileName(),
|
||||
scriptMessage.getLineNumber(), scriptMessage.getEntityID(), true);
|
||||
emit receivedNewLogLines("[ WARNING {" + scriptMessage.getEntityID().toString() + "} "
|
||||
+ scriptMessage.getFileName() + ":"
|
||||
+ QString::number(scriptMessage.getLineNumber()) + "] "
|
||||
+ scriptMessage.getMessage());
|
||||
break;
|
||||
|
||||
case ScriptMessage::Severity::SEVERITY_ERROR:
|
||||
emit scriptEngines->errorEntityMessage(scriptMessage.getMessage(), scriptMessage.getFileName(),
|
||||
scriptMessage.getLineNumber(), scriptMessage.getEntityID(), true);
|
||||
emit receivedNewLogLines("[ ERROR {" + scriptMessage.getEntityID().toString() + "} "
|
||||
+ scriptMessage.getFileName() + ":"
|
||||
+ QString::number(scriptMessage.getLineNumber()) + "] "
|
||||
+ scriptMessage.getMessage());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -267,7 +267,7 @@ signals:
|
|||
* Triggered when a client side entity script prints a message to the program log via {@link print}, {@link Script.print},
|
||||
* {@link console.log}, {@link console.debug}, {@link console.group}, {@link console.groupEnd}, {@link console.time}, or
|
||||
* {@link console.timeEnd}.
|
||||
* @function Script.printedMessage
|
||||
* @function Script.printedEntityMessage
|
||||
* @param {string} message - The message.
|
||||
* @param {string} fileName - Name of the file in which message was generated. Empty string when no file name is available.
|
||||
* @param {number} lineNumber - Number of the line on which message was generated. -1 if there line number is not available.
|
||||
|
@ -280,7 +280,7 @@ signals:
|
|||
/*@jsdoc
|
||||
* Triggered when a client side entity script generates an error, {@link console.error} or {@link console.exception} is called, or
|
||||
* {@link console.assert} is called and fails.
|
||||
* @function Script.errorMessage
|
||||
* @function Script.errorEntityMessage
|
||||
* @param {string} message - The error message.
|
||||
* @param {string} fileName - Name of the file in which message was generated. Empty string when no file name is available.
|
||||
* @param {number} lineNumber - Number of the line on which message was generated. -1 if there line number is not available.
|
||||
|
@ -292,7 +292,7 @@ signals:
|
|||
|
||||
/*@jsdoc
|
||||
* Triggered when a client side entity script generates a warning or {@link console.warn} is called.
|
||||
* @function Script.warningMessage
|
||||
* @function Script.warningEntityMessage
|
||||
* @param {string} message - The warning message.
|
||||
* @param {string} fileName - Name of the file in which message was generated. Empty string when no file name is available.
|
||||
* @param {number} lineNumber - Number of the line on which message was generated. -1 if there line number is not available.
|
||||
|
@ -304,7 +304,7 @@ signals:
|
|||
|
||||
/*@jsdoc
|
||||
* Triggered when a client side entity script generates an information message or {@link console.info} is called.
|
||||
* @function Script.infoMessage
|
||||
* @function Script.infoEntityMessage
|
||||
* @param {string} message - The information message.
|
||||
* @param {string} fileName - Name of the file in which message was generated. Empty string when no file name is available.
|
||||
* @param {number} lineNumber - Number of the line on which message was generated. -1 if there line number is not available.
|
||||
|
|
Loading…
Reference in a new issue