History

Complete console.trace and added a testcases for all 13 functions.

NeetBhagat committed 9 years ago

Commit 9646eba1 parent 5c3242615 files · +204 −165Browse files

Showing the changes to libraries/script-engine/src/ConsoleScriptingInterface.h (1 of 15 files). Show all

Unified · Split

libraries/script-engine/src/ConsoleScriptingInterface.h+15−29
@@ -2,12 +2,14 @@ · 1 unmodified line
22 // ConsoleScriptingInterface.h
33 // libraries/script-engine/src
44 //
5−// Created by volansystech on 6/1/17.
5+// Created by NeetBhagat on 6/1/17.
66 // Copyright 2014 High Fidelity, Inc.
77 //
8−// ConsoleScriptingInterface is responsible to print log.
9−// using "console" object on debug Window and Logs/log file with proper tags.
10−// Used in Javascripts file.
8+// ConsoleScriptingInterface is responsible for following functionality
9+// Printing logs with various tags and grouping on debug Window and Logs/log file.
10+// Debugging functionalities like Timer start-end, assertion, trace.
11+// To use these functionalities, use "console" object in Javascript files.
12+// For examples please refer "scripts/developer/tests/consoleObjectTest.js"
1113 //
1214 // Distributed under the Apache License, Version 2.0.
1315 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
@@ -17,17 +19,13 @@ · 3 unmodified lines
1719 #ifndef hifi_ConsoleScriptingInterface_h
1820 #define hifi_ConsoleScriptingInterface_h
1921
20−
2122 #include <QtCore/QObject>
2223 #include <QtCore/QString>
2324 #include <QtScript/QScriptable>
24−#include <QHash>
25−#include "EntityEditFilters.h"
26−#include <QUrl>
2725 #include <QList>
26+#include <QHash>
2827
29−
30−/// Scriptable interface of console object. Used exclusively in the JavaScript API
28+// Scriptable interface of "console" object. Used exclusively in the JavaScript API
3129 class ConsoleScriptingInterface : public QObject, protected QScriptable {
3230 Q_OBJECT
3331 public slots:
@@ -38,29 +36,17 @@ public slots: · 4 unmodified lines
3836 void error(QString message);
3937 void exception(QString message);
4038 void time(QString labelName);
41− void timeEnd(QString labelName);
39+ void timeEnd(QString labelName);
4240 void asserts(bool condition, QString message = "");
4341 void trace();
44− void clear();
42+ void clear();
4543 void group(QString groupName);
46− void groupCollapsed(QString groupName);
47− void groupEnd();
48− void consoleGroupLog(QString currentGroup, QString groupName);
49−public:
50− QString secondsToString(qint64 seconds);
51− bool hasCorrectSyntax(QScriptProgram& program);
52− QString hadUncaughtExceptions(QScriptEngine& engine, QString& fileName);
44+ void groupCollapsed(QString groupName);
45+ void groupEnd();
5346 private:
54− QHash<QString, QDateTime> _listOfTimeValues;
55− const qint64 DAY = 86400;
56− const QString TIME_FORMAT = "yyyy-MM-dd HH:mm";
57− QString _selectedGroup;
58− const QString GROUP = "group";
59− const QString GROUPCOLLAPSED = "groupCollapse";
60− const QString GROUPEND = "groupEnd";
61− bool _isSameLevel = false;
62− QString _addSpace = "";
63− bool _isGroupEnd = true;
47+ QHash<QString, QDateTime> _timerDetails;
48+ QList<QString> _groupDetails;
49+ void logGroupMessage(QString msg);
6450 };
6551
6652 #endif // hifi_ConsoleScriptingInterface_h