Merge lp:~justinmcp/unity-webapps-qml/logging into lp:unity-webapps-qml

Proposed by Justin McPherson
Status: Needs review
Proposed branch: lp:~justinmcp/unity-webapps-qml/logging
Merge into: lp:unity-webapps-qml
Diff against target: 92 lines (+37/-4)
3 files modified
src/Ubuntu/UnityWebApps/UnityWebApps.js (+8/-4)
src/Ubuntu/UnityWebApps/UnityWebApps.qml (+24/-0)
src/Ubuntu/UnityWebApps/unity-webapps-api.js.in (+5/-0)
To merge this branch: bzr merge lp:~justinmcp/unity-webapps-qml/logging
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
WebApps Pending
Review via email: mp+213586@code.launchpad.net

Commit message

- Enable display of logging information from the webbrowser app.
- Hide integration logging messages in the intergration category.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
105. By Justin McPherson

merge with trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
106. By Justin McPherson

merge from trunk

107. By Justin McPherson

merge from trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Unmerged revisions

107. By Justin McPherson

merge from trunk

106. By Justin McPherson

merge from trunk

105. By Justin McPherson

merge with trunk

104. By Justin McPherson

Changes to logging.

- Rename property to loggingCategories
- Make dynamic

103. By Justin McPherson

Enable conditional logging.

Based on an array of strings. Each string represents the type of logging of
interest.

102. By Justin McPherson

Allow webapp logging through Unity.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.js'
2--- src/Ubuntu/UnityWebApps/UnityWebApps.js 2014-03-18 18:52:11 +0000
3+++ src/Ubuntu/UnityWebApps/UnityWebApps.js 2014-04-11 07:20:27 +0000
4@@ -37,11 +37,11 @@
5 * \param userscriptContent
6 */
7 function _UnityWebApps(parentItem, bindeeProxies, backends, userscripts) {
8+ this._parent = parentItem;
9 this._injected_unity_api_path = Qt.resolvedUrl('unity-webapps-api.js');
10 this._bindeeProxies = bindeeProxies;
11 this._backends = backends;
12 this._userscripts = userscripts || [];
13-
14 this._bind();
15 };
16
17@@ -247,10 +247,14 @@
18 *
19 */
20 _log: function (msg) {
21- try {
22- console.debug(msg);
23+ if (this._parent.loggingCategories !== undefined && this._parent.loggingCategories.length > 0) {
24+ if (this._parent.loggingCategories.indexOf('integration') !== -1) {
25+ try {
26+ console.debug(msg);
27+ }
28+ catch(e) {}
29+ }
30 }
31- catch(e) {}
32 },
33
34 /**
35
36=== modified file 'src/Ubuntu/UnityWebApps/UnityWebApps.qml'
37--- src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-03-26 15:52:46 +0000
38+++ src/Ubuntu/UnityWebApps/UnityWebApps.qml 2014-04-11 07:20:27 +0000
39@@ -144,6 +144,12 @@
40 */
41 property var _opt_backendProxies: null
42
43+ /*!
44+ \qmlproperty var UnityWebApps::loggingCategories
45+
46+ An array of strings indicating logging types that should be enabled.
47+ */
48+ property var loggingCategories: []
49
50 Settings {
51 id: settings
52@@ -742,6 +748,24 @@
53 }
54 },
55 __actionNames: {}
56+ },
57+
58+ Logger: {
59+ info: function (strings) {
60+ if (loggingCategories.length > 0 && loggingCategories.indexOf('web_console') !== -1) {
61+ console.log("LOG: " + strings);
62+ }
63+ },
64+ warning: function (strings) {
65+ if (loggingCategories.length > 0 && loggingCategories.indexOf('web_console') !== -1) {
66+ console.warn("WARNING: " + strings);
67+ }
68+ },
69+ error: function (strings) {
70+ if (loggingCategories.length > 0 && loggingCategories.indexOf('web_console') !== -1) {
71+ console.error("ERROR: " + strings);
72+ }
73+ }
74 }
75 };
76 }
77
78=== modified file 'src/Ubuntu/UnityWebApps/unity-webapps-api.js.in'
79--- src/Ubuntu/UnityWebApps/unity-webapps-api.js.in 2014-03-26 15:52:46 +0000
80+++ src/Ubuntu/UnityWebApps/unity-webapps-api.js.in 2014-04-11 07:20:27 +0000
81@@ -282,6 +282,11 @@
82 AlarmApi: createAlarmApi(backend),
83 ContentHub: createContentHubApi(backend),
84 RuntimeApi: createRuntimeApi(backend),
85+ Logger: {
86+ info: createArgumentsSanitizer (backend, [{ str: true }], 'Logger.info'),
87+ warning: createArgumentsSanitizer (backend, [{ str: true }], 'Logger.warning'),
88+ error: createArgumentsSanitizer (backend, [{ str: true }], 'Logger.error')
89+ },
90 };
91
92 return api;

Subscribers

People subscribed via source and target branches

to all changes: