ionic-logging-viewer 10.0.0 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +10 -6
  2. package/esm2020/ionic-logging-viewer.mjs +5 -0
  3. package/esm2020/lib/logging-viewer/logging-viewer.component.mjs +119 -0
  4. package/esm2020/lib/logging-viewer-filter.service.mjs +64 -0
  5. package/esm2020/lib/logging-viewer-levels/logging-viewer-levels.component.mjs +71 -0
  6. package/esm2020/lib/logging-viewer-modal/logging-viewer-modal-properties.model.mjs +2 -0
  7. package/esm2020/lib/logging-viewer-modal/logging-viewer-modal.component.mjs +141 -0
  8. package/esm2020/lib/logging-viewer-search/logging-viewer-search.component.mjs +73 -0
  9. package/esm2020/lib/logging-viewer-translation.model.mjs +2 -0
  10. package/esm2020/lib/logging-viewer.module.mjs +55 -0
  11. package/esm2020/public_api.mjs +11 -0
  12. package/fesm2015/ionic-logging-viewer.mjs +500 -0
  13. package/fesm2015/ionic-logging-viewer.mjs.map +1 -0
  14. package/fesm2020/ionic-logging-viewer.mjs +495 -0
  15. package/fesm2020/ionic-logging-viewer.mjs.map +1 -0
  16. package/ionic-logging-viewer.d.ts +1 -1
  17. package/lib/logging-viewer/logging-viewer.component.d.ts +3 -0
  18. package/lib/logging-viewer-filter.service.d.ts +8 -0
  19. package/lib/logging-viewer-levels/logging-viewer-levels.component.d.ts +3 -0
  20. package/lib/logging-viewer-modal/logging-viewer-modal.component.d.ts +3 -0
  21. package/lib/logging-viewer-search/logging-viewer-search.component.d.ts +3 -0
  22. package/lib/logging-viewer.module.d.ts +11 -0
  23. package/package.json +28 -16
  24. package/bundles/ionic-logging-viewer.umd.js +0 -782
  25. package/bundles/ionic-logging-viewer.umd.js.map +0 -1
  26. package/bundles/ionic-logging-viewer.umd.min.js +0 -16
  27. package/bundles/ionic-logging-viewer.umd.min.js.map +0 -1
  28. package/esm2015/ionic-logging-viewer.js +0 -6
  29. package/esm2015/lib/logging-viewer/logging-viewer.component.js +0 -127
  30. package/esm2015/lib/logging-viewer-filter.service.js +0 -60
  31. package/esm2015/lib/logging-viewer-levels/logging-viewer-levels.component.js +0 -74
  32. package/esm2015/lib/logging-viewer-modal/logging-viewer-modal-properties.model.js +0 -1
  33. package/esm2015/lib/logging-viewer-modal/logging-viewer-modal.component.js +0 -158
  34. package/esm2015/lib/logging-viewer-search/logging-viewer-search.component.js +0 -79
  35. package/esm2015/lib/logging-viewer-translation.model.js +0 -1
  36. package/esm2015/lib/logging-viewer.module.js +0 -39
  37. package/esm2015/public_api.js +0 -9
  38. package/esm5/ionic-logging-viewer.js +0 -6
  39. package/esm5/lib/logging-viewer/logging-viewer.component.js +0 -144
  40. package/esm5/lib/logging-viewer-filter.service.js +0 -69
  41. package/esm5/lib/logging-viewer-levels/logging-viewer-levels.component.js +0 -76
  42. package/esm5/lib/logging-viewer-modal/logging-viewer-modal-properties.model.js +0 -1
  43. package/esm5/lib/logging-viewer-modal/logging-viewer-modal.component.js +0 -191
  44. package/esm5/lib/logging-viewer-search/logging-viewer-search.component.js +0 -81
  45. package/esm5/lib/logging-viewer-translation.model.js +0 -1
  46. package/esm5/lib/logging-viewer.module.js +0 -42
  47. package/esm5/public_api.js +0 -9
  48. package/fesm2015/ionic-logging-viewer.js +0 -519
  49. package/fesm2015/ionic-logging-viewer.js.map +0 -1
  50. package/fesm5/ionic-logging-viewer.js +0 -585
  51. package/fesm5/ionic-logging-viewer.js.map +0 -1
  52. package/ionic-logging-viewer.metadata.json +0 -1
@@ -1,782 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('@ionic/angular'), require('ionic-logging-service')) :
3
- typeof define === 'function' && define.amd ? define('ionic-logging-viewer', ['exports', '@angular/core', '@angular/common', '@angular/forms', '@ionic/angular', 'ionic-logging-service'], factory) :
4
- (global = global || self, factory(global['ionic-logging-viewer'] = {}, global.ng.core, global.ng.common, global.ng.forms, global.angular, global.ionicLoggingService));
5
- }(this, (function (exports, core, common, forms, angular, ionicLoggingService) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation. All rights reserved.
9
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
10
- this file except in compliance with the License. You may obtain a copy of the
11
- License at http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
15
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
16
- MERCHANTABLITY OR NON-INFRINGEMENT.
17
-
18
- See the Apache Version 2.0 License for specific language governing permissions
19
- and limitations under the License.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- var __assign = function() {
37
- __assign = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
- }
42
- return t;
43
- };
44
- return __assign.apply(this, arguments);
45
- };
46
-
47
- function __rest(s, e) {
48
- var t = {};
49
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
- t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
- t[p[i]] = s[p[i]];
55
- }
56
- return t;
57
- }
58
-
59
- function __decorate(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
62
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
63
- return c > 3 && r && Object.defineProperty(target, key, r), r;
64
- }
65
-
66
- function __param(paramIndex, decorator) {
67
- return function (target, key) { decorator(target, key, paramIndex); }
68
- }
69
-
70
- function __metadata(metadataKey, metadataValue) {
71
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
72
- }
73
-
74
- function __awaiter(thisArg, _arguments, P, generator) {
75
- return new (P || (P = Promise))(function (resolve, reject) {
76
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
77
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
78
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
79
- step((generator = generator.apply(thisArg, _arguments || [])).next());
80
- });
81
- }
82
-
83
- function __generator(thisArg, body) {
84
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
85
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
86
- function verb(n) { return function (v) { return step([n, v]); }; }
87
- function step(op) {
88
- if (f) throw new TypeError("Generator is already executing.");
89
- while (_) try {
90
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
91
- if (y = 0, t) op = [op[0] & 2, t.value];
92
- switch (op[0]) {
93
- case 0: case 1: t = op; break;
94
- case 4: _.label++; return { value: op[1], done: false };
95
- case 5: _.label++; y = op[1]; op = [0]; continue;
96
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
97
- default:
98
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
99
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
100
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
101
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
102
- if (t[2]) _.ops.pop();
103
- _.trys.pop(); continue;
104
- }
105
- op = body.call(thisArg, _);
106
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
107
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
108
- }
109
- }
110
-
111
- function __exportStar(m, exports) {
112
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
113
- }
114
-
115
- function __values(o) {
116
- var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
117
- if (m) return m.call(o);
118
- return {
119
- next: function () {
120
- if (o && i >= o.length) o = void 0;
121
- return { value: o && o[i++], done: !o };
122
- }
123
- };
124
- }
125
-
126
- function __read(o, n) {
127
- var m = typeof Symbol === "function" && o[Symbol.iterator];
128
- if (!m) return o;
129
- var i = m.call(o), r, ar = [], e;
130
- try {
131
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
132
- }
133
- catch (error) { e = { error: error }; }
134
- finally {
135
- try {
136
- if (r && !r.done && (m = i["return"])) m.call(i);
137
- }
138
- finally { if (e) throw e.error; }
139
- }
140
- return ar;
141
- }
142
-
143
- function __spread() {
144
- for (var ar = [], i = 0; i < arguments.length; i++)
145
- ar = ar.concat(__read(arguments[i]));
146
- return ar;
147
- }
148
-
149
- function __spreadArrays() {
150
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
151
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
152
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
153
- r[k] = a[j];
154
- return r;
155
- };
156
-
157
- function __await(v) {
158
- return this instanceof __await ? (this.v = v, this) : new __await(v);
159
- }
160
-
161
- function __asyncGenerator(thisArg, _arguments, generator) {
162
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
163
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
164
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
165
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
166
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
167
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
168
- function fulfill(value) { resume("next", value); }
169
- function reject(value) { resume("throw", value); }
170
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
171
- }
172
-
173
- function __asyncDelegator(o) {
174
- var i, p;
175
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
176
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
177
- }
178
-
179
- function __asyncValues(o) {
180
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
181
- var m = o[Symbol.asyncIterator], i;
182
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
183
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
184
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
185
- }
186
-
187
- function __makeTemplateObject(cooked, raw) {
188
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
189
- return cooked;
190
- };
191
-
192
- function __importStar(mod) {
193
- if (mod && mod.__esModule) return mod;
194
- var result = {};
195
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
196
- result.default = mod;
197
- return result;
198
- }
199
-
200
- function __importDefault(mod) {
201
- return (mod && mod.__esModule) ? mod : { default: mod };
202
- }
203
-
204
- /**
205
- * Service for storing filter settings for logging viewer.
206
- */
207
- var LoggingViewerFilterService = /** @class */ (function () {
208
- /**
209
- * Creates a new instance of the service.
210
- * @param loggingService needed for internal logging.
211
- */
212
- function LoggingViewerFilterService(loggingService) {
213
- this.logger = loggingService.getLogger("Ionic.Logging.Viewer.Filter.Service");
214
- var methodName = "ctor";
215
- this.logger.entry(methodName);
216
- this.levelValue = "DEBUG";
217
- this.searchValue = "";
218
- this.filterChanged = new core.EventEmitter();
219
- this.logger.exit(methodName);
220
- }
221
- Object.defineProperty(LoggingViewerFilterService.prototype, "level", {
222
- /**
223
- * Gets the current log level.
224
- * @return log level
225
- */
226
- get: function () {
227
- return this.levelValue;
228
- },
229
- /**
230
- * Sets the new log level and emits a filterChanged event.
231
- * @param value new slog level
232
- */
233
- set: function (value) {
234
- this.levelValue = value;
235
- this.filterChanged.emit();
236
- },
237
- enumerable: true,
238
- configurable: true
239
- });
240
- Object.defineProperty(LoggingViewerFilterService.prototype, "search", {
241
- /**
242
- * Gets the current search value.
243
- * @return search value
244
- */
245
- get: function () {
246
- return this.searchValue;
247
- },
248
- /**
249
- * Sets the new search value and emits a filterChanged event.
250
- * @param value new search value
251
- */
252
- set: function (value) {
253
- this.searchValue = value;
254
- this.filterChanged.emit();
255
- },
256
- enumerable: true,
257
- configurable: true
258
- });
259
- LoggingViewerFilterService.ctorParameters = function () { return [
260
- { type: ionicLoggingService.LoggingService }
261
- ]; };
262
- LoggingViewerFilterService = __decorate([
263
- core.Injectable(),
264
- __metadata("design:paramtypes", [ionicLoggingService.LoggingService])
265
- ], LoggingViewerFilterService);
266
- return LoggingViewerFilterService;
267
- }());
268
-
269
- /**
270
- * Component for displaying the current logs.
271
- *
272
- * The component can be embedded in any web page using:
273
- *
274
- * &lt;ionic-logging-viewer>&lt;/ionic-logging-viewer>
275
- */
276
- var LoggingViewerComponent = /** @class */ (function () {
277
- /**
278
- * Creates a new instance of the component.
279
- */
280
- function LoggingViewerComponent(loggingService, loggingViewerFilterService) {
281
- this.loggingService = loggingService;
282
- this.loggingViewerFilterService = loggingViewerFilterService;
283
- this.logger = loggingService.getLogger("Ionic.Logging.Viewer.Component");
284
- var methodName = "ctor";
285
- this.logger.entry(methodName);
286
- this.logger.exit(methodName);
287
- }
288
- /**
289
- * Initialize the component.
290
- *
291
- * This is done by reading the filter data from [LoggingViewerFilterService](LoggingViewerFilterService.html)
292
- * and the log messages from [LoggingService](../../../ionic-logging-service/typedoc/index.html).
293
- * If the localStorageKeys property is set, the messages are read from local storage.
294
- */
295
- LoggingViewerComponent.prototype.ngOnInit = function () {
296
- var _this = this;
297
- var methodName = "ngOnInit";
298
- this.logger.entry(methodName);
299
- this.loadLogMessages();
300
- this.filterLogMessages();
301
- // subscribe to loggingService.logMessagesChanged event, to refresh, when new message is logged
302
- this.logMessagesChangedSubscription = this.loggingService.logMessagesChanged.subscribe(function () { return __awaiter(_this, void 0, void 0, function () {
303
- return __generator(this, function (_a) {
304
- this.loadLogMessages();
305
- this.filterLogMessages();
306
- return [2 /*return*/];
307
- });
308
- }); });
309
- // subscribe to loggingViewerFilterService.filterChanged event, to refresh, when filter is modified
310
- this.filterChangedSubscription = this.loggingViewerFilterService.filterChanged.subscribe(function () {
311
- _this.filterLogMessages();
312
- });
313
- this.logger.exit(methodName);
314
- };
315
- /**
316
- * Clean up.
317
- */
318
- LoggingViewerComponent.prototype.ngOnDestroy = function () {
319
- var methodName = "ngOnDestroy";
320
- this.logger.entry(methodName);
321
- this.logMessagesChangedSubscription.unsubscribe();
322
- this.filterChangedSubscription.unsubscribe();
323
- this.logger.exit(methodName);
324
- };
325
- /**
326
- * Filter the log messages.
327
- */
328
- LoggingViewerComponent.prototype.filterLogMessages = function () {
329
- var _this = this;
330
- this.logMessagesForDisplay = this.logMessages.filter(function (message) {
331
- return _this.filterLogMessagesByLevel(message) && _this.filterLogMessagesBySearch(message);
332
- });
333
- };
334
- /**
335
- * Check if the log message's level fulfills the level condition.
336
- *
337
- * @param message the log message to check
338
- * @returns true if check was successful
339
- */
340
- LoggingViewerComponent.prototype.filterLogMessagesByLevel = function (message) {
341
- var levelValue = this.loggingViewerFilterService.level;
342
- return ionicLoggingService.LogLevelConverter.levelFromString(message.level) >= ionicLoggingService.LogLevelConverter.levelFromString(levelValue);
343
- };
344
- /**
345
- * Check if the log message fulfills the search condition.
346
- *
347
- * The search value gets searched in:
348
- * - logger name
349
- * - method name
350
- * - message
351
- *
352
- * @param message the log message to check
353
- * @returns true if check was successful
354
- */
355
- LoggingViewerComponent.prototype.filterLogMessagesBySearch = function (message) {
356
- var searchValue = new RegExp(this.loggingViewerFilterService.search, "i");
357
- return message.logger.search(searchValue) >= 0 ||
358
- message.methodName.search(searchValue) >= 0 ||
359
- message.message.join("|").search(searchValue) >= 0;
360
- };
361
- /**
362
- * Load the current log messages.
363
- * For unit test purposes mainly.
364
- */
365
- LoggingViewerComponent.prototype.loadLogMessages = function () {
366
- var e_1, _a;
367
- if (this.localStorageKeys) {
368
- this.logMessages = [];
369
- try {
370
- for (var _b = __values(this.localStorageKeys.split(",")), _c = _b.next(); !_c.done; _c = _b.next()) {
371
- var localStorageKey = _c.value;
372
- this.logMessages = this.logMessages.concat(this.loggingService.getLogMessagesFromLocalStorage(localStorageKey));
373
- }
374
- }
375
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
376
- finally {
377
- try {
378
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
379
- }
380
- finally { if (e_1) throw e_1.error; }
381
- }
382
- this.logMessages = this.logMessages.sort(function (a, b) { return a.timeStamp.getTime() - b.timeStamp.getTime(); });
383
- }
384
- else {
385
- this.logMessages = this.loggingService.getLogMessages();
386
- }
387
- };
388
- LoggingViewerComponent.ctorParameters = function () { return [
389
- { type: ionicLoggingService.LoggingService },
390
- { type: LoggingViewerFilterService }
391
- ]; };
392
- __decorate([
393
- core.Input(),
394
- __metadata("design:type", String)
395
- ], LoggingViewerComponent.prototype, "localStorageKeys", void 0);
396
- LoggingViewerComponent = __decorate([
397
- core.Component({
398
- selector: "ionic-logging-viewer",
399
- template: "<ion-list>\n\t<ion-item *ngFor=\"let logMessage of logMessagesForDisplay\">\n\t\t<ion-label>\n\t\t\t<p>{{ logMessage.timeStamp | date:'dd.MM.yyyy HH:mm:ss' }} {{ logMessage.level }}</p>\n\t\t\t<p>{{ logMessage.logger }}</p>\n\t\t\t<p>\n\t\t\t\t{{ logMessage.methodName }}\n\t\t\t\t<span *ngFor=\"let messagePart of logMessage.message\"> {{ messagePart }} </span>\n\t\t\t</p>\n\t\t</ion-label>\n\t</ion-item>\n</ion-list>",
400
- styles: [""]
401
- }),
402
- __metadata("design:paramtypes", [ionicLoggingService.LoggingService,
403
- LoggingViewerFilterService])
404
- ], LoggingViewerComponent);
405
- return LoggingViewerComponent;
406
- }());
407
-
408
- /**
409
- * Component for displaying the log levels for filtering the current logs.
410
- *
411
- * The component can be embedded in any web page using:
412
- *
413
- * &lt;ionic-logging-viewer-levels>&lt;/ionic-logging-viewer-levels>
414
- */
415
- var LoggingViewerLevelsComponent = /** @class */ (function () {
416
- /**
417
- * Creates a new instance of the component.
418
- */
419
- function LoggingViewerLevelsComponent(loggingService, loggingViewerFilterService) {
420
- this.loggingViewerFilterService = loggingViewerFilterService;
421
- this.logger = loggingService.getLogger("Ionic.Logging.Viewer.Levels.Component");
422
- var methodName = "ctor";
423
- this.logger.entry(methodName);
424
- this.logLevels = [];
425
- this.logLevels.push("DEBUG", "INFO", "WARN", "ERROR");
426
- this.logger.exit(methodName);
427
- }
428
- /**
429
- * Initialize the component.
430
- *
431
- * This is done by reading the filter data from [LoggingViewerFilterService](LoggingViewerFilterService.html).
432
- */
433
- LoggingViewerLevelsComponent.prototype.ngOnInit = function () {
434
- var _this = this;
435
- var methodName = "ngOnInit";
436
- this.logger.entry(methodName);
437
- this.selectedLevel = this.loggingViewerFilterService.level;
438
- // subscribe to loggingViewerFilterService.filterChanged event, to refresh,
439
- // when someone else modifies the level
440
- this.filterChangedSubscription = this.loggingViewerFilterService.filterChanged.subscribe(function () {
441
- _this.selectedLevel = _this.loggingViewerFilterService.level;
442
- });
443
- this.logger.exit(methodName);
444
- };
445
- /**
446
- * Clean up.
447
- */
448
- LoggingViewerLevelsComponent.prototype.ngOnDestroy = function () {
449
- var methodName = "ngOnDestroy";
450
- this.logger.entry(methodName);
451
- this.filterChangedSubscription.unsubscribe();
452
- this.logger.exit(methodName);
453
- };
454
- /**
455
- * Callback when the level was changed in the UI.
456
- */
457
- LoggingViewerLevelsComponent.prototype.onLevelChanged = function () {
458
- var methodName = "onLevelChanged";
459
- this.logger.entry(methodName, this.selectedLevel);
460
- this.loggingViewerFilterService.level = this.selectedLevel;
461
- this.logger.exit(methodName);
462
- };
463
- LoggingViewerLevelsComponent.ctorParameters = function () { return [
464
- { type: ionicLoggingService.LoggingService },
465
- { type: LoggingViewerFilterService }
466
- ]; };
467
- LoggingViewerLevelsComponent = __decorate([
468
- core.Component({
469
- selector: "ionic-logging-viewer-levels",
470
- template: "<ion-segment [(ngModel)]=\"selectedLevel\" (ionChange)=\"onLevelChanged()\">\n\t<ion-segment-button *ngFor=\"let logLevel of logLevels\" [value]=\"logLevel\">\n\t\t<ion-label>{{ logLevel }}</ion-label>\n\t</ion-segment-button>\n</ion-segment>",
471
- styles: [""]
472
- }),
473
- __metadata("design:paramtypes", [ionicLoggingService.LoggingService,
474
- LoggingViewerFilterService])
475
- ], LoggingViewerLevelsComponent);
476
- return LoggingViewerLevelsComponent;
477
- }());
478
-
479
- /**
480
- * Component for displaying the search bar for filtering the current logs.
481
- *
482
- * The component can be embedded in any web page using:
483
- *
484
- * &lt;ionic-logging-viewer-search placeholder="Search">&lt;/ionic-logging-viewer-search>
485
- */
486
- var LoggingViewerSearchComponent = /** @class */ (function () {
487
- /**
488
- * Creates a new instance of the component.
489
- */
490
- function LoggingViewerSearchComponent(loggingService, loggingViewerFilterService) {
491
- this.loggingViewerFilterService = loggingViewerFilterService;
492
- this.logger = loggingService.getLogger("Ionic.Logging.Viewer.Search.Component");
493
- var methodName = "ctor";
494
- this.logger.entry(methodName);
495
- this.logger.exit(methodName);
496
- }
497
- /**
498
- * Initialize the component.
499
- *
500
- * This is done by reading the filter data from [LoggingViewerFilterService](LoggingViewerFilterService.html).
501
- */
502
- LoggingViewerSearchComponent.prototype.ngOnInit = function () {
503
- var _this = this;
504
- var methodName = "ngOnInit";
505
- this.logger.entry(methodName);
506
- if (!this.placeholder) {
507
- this.placeholder = "Search";
508
- }
509
- this.search = this.loggingViewerFilterService.search;
510
- // subscribe to loggingViewerFilterService.filterChanged event, to refresh,
511
- // when someone else modifies the search value
512
- this.filterChangedSubscription = this.loggingViewerFilterService.filterChanged.subscribe(function () {
513
- _this.search = _this.loggingViewerFilterService.search;
514
- });
515
- this.logger.exit(methodName);
516
- };
517
- /**
518
- * Clean up.
519
- */
520
- LoggingViewerSearchComponent.prototype.ngOnDestroy = function () {
521
- var methodName = "ngOnDestroy";
522
- this.logger.entry(methodName);
523
- this.filterChangedSubscription.unsubscribe();
524
- this.logger.exit(methodName);
525
- };
526
- /**
527
- * Callback when the search value was changed in the UI.
528
- */
529
- LoggingViewerSearchComponent.prototype.onSearchChanged = function () {
530
- var methodName = "onSearchChanged";
531
- this.logger.entry(methodName, this.search);
532
- this.loggingViewerFilterService.search = this.search;
533
- this.logger.exit(methodName);
534
- };
535
- LoggingViewerSearchComponent.ctorParameters = function () { return [
536
- { type: ionicLoggingService.LoggingService },
537
- { type: LoggingViewerFilterService }
538
- ]; };
539
- __decorate([
540
- core.Input(),
541
- __metadata("design:type", String)
542
- ], LoggingViewerSearchComponent.prototype, "placeholder", void 0);
543
- LoggingViewerSearchComponent = __decorate([
544
- core.Component({
545
- selector: "ionic-logging-viewer-search",
546
- template: "<ion-searchbar placeholder=\"{{placeholder}}\" [(ngModel)]=\"search\" (ionChange)=\"onSearchChanged()\"></ion-searchbar>",
547
- styles: ["ion-searchbar{padding-top:3px;padding-bottom:0}"]
548
- }),
549
- __metadata("design:paramtypes", [ionicLoggingService.LoggingService,
550
- LoggingViewerFilterService])
551
- ], LoggingViewerSearchComponent);
552
- return LoggingViewerSearchComponent;
553
- }());
554
-
555
- /**
556
- * Ionic modal containing [LoggingViewerComponent](LoggingViewerComponent.html),
557
- * [LoggingViewerLevelsComponent](LoggingViewerLevelsComponent.html) and
558
- * [LoggingViewerSearchComponent](LoggingViewerSearchComponent.html).
559
- */
560
- var LoggingViewerModalComponent = /** @class */ (function () {
561
- /**
562
- * Creates a new instance of the component.
563
- */
564
- function LoggingViewerModalComponent(platform, alertController, modalController, loggingService) {
565
- this.alertController = alertController;
566
- this.modalController = modalController;
567
- this.loggingService = loggingService;
568
- this.logger = loggingService.getLogger("Ionic.Logging.Viewer.Modal.Component");
569
- var methodName = "ctor";
570
- this.logger.entry(methodName);
571
- this.isAndroid = platform.is("android");
572
- this.logger.exit(methodName);
573
- }
574
- LoggingViewerModalComponent_1 = LoggingViewerModalComponent;
575
- /**
576
- * Initializes the LoggingViewerModalComponent.
577
- * It configures the supported translations.
578
- */
579
- LoggingViewerModalComponent.prototype.ngOnInit = function () {
580
- // prepare translations
581
- this.translations = {};
582
- this.translations[LoggingViewerModalComponent_1.languageEn] = {
583
- cancel: "Cancel",
584
- confirmDelete: "Delete all log messages?",
585
- ok: "Ok",
586
- searchPlaceholder: "Search",
587
- title: "Logging",
588
- };
589
- this.translations[LoggingViewerModalComponent_1.languageDe] = {
590
- cancel: "Abbrechen",
591
- confirmDelete: "Alle Logs löschen?",
592
- ok: "Ok",
593
- searchPlaceholder: "Suchen",
594
- title: "Logging",
595
- };
596
- };
597
- /**
598
- * Eventhandler called by Ionic when the modal is opened.
599
- */
600
- LoggingViewerModalComponent.prototype.ionViewDidEnter = function () {
601
- var methodName = "ionViewDidEnter";
602
- this.logger.entry(methodName);
603
- this.logger.exit(methodName);
604
- };
605
- /**
606
- * Eventhandler called when the cancel button is clicked.
607
- */
608
- LoggingViewerModalComponent.prototype.onClose = function () {
609
- return __awaiter(this, void 0, void 0, function () {
610
- var methodName;
611
- return __generator(this, function (_a) {
612
- switch (_a.label) {
613
- case 0:
614
- methodName = "onClose";
615
- this.logger.entry(methodName);
616
- return [4 /*yield*/, this.modalController.dismiss()];
617
- case 1:
618
- _a.sent();
619
- this.logger.exit(methodName);
620
- return [2 /*return*/];
621
- }
622
- });
623
- });
624
- };
625
- /**
626
- * Eventhandler called when the clear button is clicked.
627
- */
628
- LoggingViewerModalComponent.prototype.onClearLogs = function () {
629
- return __awaiter(this, void 0, void 0, function () {
630
- var methodName, alert;
631
- return __generator(this, function (_a) {
632
- switch (_a.label) {
633
- case 0:
634
- methodName = "onClearLogs";
635
- this.logger.entry(methodName);
636
- return [4 /*yield*/, this.alertController.create({
637
- header: this.getTranslation().confirmDelete,
638
- buttons: [
639
- {
640
- text: this.getTranslation().cancel,
641
- role: "cancel",
642
- cssClass: "secondary"
643
- },
644
- {
645
- text: this.getTranslation().ok,
646
- handler: this.clearLogs
647
- },
648
- ]
649
- })];
650
- case 1:
651
- alert = _a.sent();
652
- return [4 /*yield*/, alert.present()];
653
- case 2:
654
- _a.sent();
655
- this.logger.exit(methodName);
656
- return [2 /*return*/];
657
- }
658
- });
659
- });
660
- };
661
- /**
662
- * Clear logs.
663
- */
664
- LoggingViewerModalComponent.prototype.clearLogs = function () {
665
- var e_1, _a;
666
- if (this.localStorageKeys) {
667
- try {
668
- for (var _b = __values(this.localStorageKeys.split(",")), _c = _b.next(); !_c.done; _c = _b.next()) {
669
- var localStorageKey = _c.value;
670
- this.loggingService.removeLogMessagesFromLocalStorage(localStorageKey);
671
- }
672
- }
673
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
674
- finally {
675
- try {
676
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
677
- }
678
- finally { if (e_1) throw e_1.error; }
679
- }
680
- }
681
- else {
682
- this.loggingService.removeLogMessages();
683
- }
684
- };
685
- /**
686
- * Helper method returning the current translation:
687
- * - the property translation if defined
688
- * - the translation according property language if valid
689
- * - English translation, otherwise
690
- */
691
- LoggingViewerModalComponent.prototype.getTranslation = function () {
692
- if (typeof this.translation !== "undefined") {
693
- return this.translation;
694
- }
695
- else if (typeof this.language !== "undefined" && typeof this.translations[this.language] === "object") {
696
- return this.translations[this.language];
697
- }
698
- else {
699
- return this.translations[LoggingViewerModalComponent_1.languageEn];
700
- }
701
- };
702
- var LoggingViewerModalComponent_1;
703
- LoggingViewerModalComponent.languageEn = "en";
704
- LoggingViewerModalComponent.languageDe = "de";
705
- LoggingViewerModalComponent.ctorParameters = function () { return [
706
- { type: angular.Platform },
707
- { type: angular.AlertController },
708
- { type: angular.ModalController },
709
- { type: ionicLoggingService.LoggingService }
710
- ]; };
711
- __decorate([
712
- core.Input(),
713
- __metadata("design:type", String)
714
- ], LoggingViewerModalComponent.prototype, "language", void 0);
715
- __decorate([
716
- core.Input(),
717
- __metadata("design:type", Object)
718
- ], LoggingViewerModalComponent.prototype, "translation", void 0);
719
- __decorate([
720
- core.Input(),
721
- __metadata("design:type", String)
722
- ], LoggingViewerModalComponent.prototype, "localStorageKeys", void 0);
723
- __decorate([
724
- core.Input(),
725
- __metadata("design:type", Boolean)
726
- ], LoggingViewerModalComponent.prototype, "allowClearLogs", void 0);
727
- LoggingViewerModalComponent = LoggingViewerModalComponent_1 = __decorate([
728
- core.Component({
729
- selector: "ionic-logging-viewer-modal",
730
- template: "<ion-header>\n\t<ion-toolbar color=primary>\n\t\t<ion-title>{{ getTranslation().title }}</ion-title>\n\t\t<ion-buttons slot=\"start\">\n\t\t\t<ion-button *ngIf=\"!isAndroid\" (click)=\"onClose()\">\n\t\t\t\t{{ getTranslation().cancel }}\n\t\t\t</ion-button>\n\t\t\t<ion-button *ngIf=\"isAndroid\" icon-only (click)=\"onClose()\">\n\t\t\t\t<ion-icon name=\"md-close\"></ion-icon>\n\t\t\t</ion-button>\n\t\t</ion-buttons>\n\t</ion-toolbar>\n\t<ion-toolbar>\n\t\t<ionic-logging-viewer-search [placeholder]=\"getTranslation().searchPlaceholder\"></ionic-logging-viewer-search>\n\t\t<ion-buttons slot=\"end\" *ngIf=\"allowClearLogs !== false\" class=\"clearLogs\">\n\t\t\t<ion-button (click)=\"onClearLogs()\">\n\t\t\t\t<ion-icon name=\"trash-outline\"></ion-icon>\n\t\t\t</ion-button>\n\t\t</ion-buttons>\n\t</ion-toolbar>\n\t<ion-toolbar>\n\t\t<ionic-logging-viewer-levels></ionic-logging-viewer-levels>\n\t</ion-toolbar>\n</ion-header>\n<ion-content>\n\t<ionic-logging-viewer [localStorageKeys]=\"localStorageKeys\"></ionic-logging-viewer>\n</ion-content>",
731
- styles: ["ionic-logging-viewer-levels{width:100%;padding-left:12px;padding-right:12px}.clearLogs{padding-top:3px}"]
732
- }),
733
- __metadata("design:paramtypes", [angular.Platform,
734
- angular.AlertController,
735
- angular.ModalController,
736
- ionicLoggingService.LoggingService])
737
- ], LoggingViewerModalComponent);
738
- return LoggingViewerModalComponent;
739
- }());
740
-
741
- var LoggingViewerModule = /** @class */ (function () {
742
- function LoggingViewerModule() {
743
- }
744
- LoggingViewerModule = __decorate([
745
- core.NgModule({
746
- imports: [
747
- common.CommonModule,
748
- forms.FormsModule,
749
- angular.IonicModule
750
- ],
751
- declarations: [
752
- LoggingViewerComponent,
753
- LoggingViewerSearchComponent,
754
- LoggingViewerLevelsComponent,
755
- LoggingViewerModalComponent
756
- ],
757
- entryComponents: [],
758
- exports: [
759
- LoggingViewerComponent,
760
- LoggingViewerSearchComponent,
761
- LoggingViewerLevelsComponent,
762
- LoggingViewerModalComponent
763
- ],
764
- providers: [
765
- LoggingViewerFilterService
766
- ]
767
- })
768
- ], LoggingViewerModule);
769
- return LoggingViewerModule;
770
- }());
771
-
772
- exports.LoggingViewerComponent = LoggingViewerComponent;
773
- exports.LoggingViewerLevelsComponent = LoggingViewerLevelsComponent;
774
- exports.LoggingViewerModalComponent = LoggingViewerModalComponent;
775
- exports.LoggingViewerModule = LoggingViewerModule;
776
- exports.LoggingViewerSearchComponent = LoggingViewerSearchComponent;
777
- exports.ɵa = LoggingViewerFilterService;
778
-
779
- Object.defineProperty(exports, '__esModule', { value: true });
780
-
781
- })));
782
- //# sourceMappingURL=ionic-logging-viewer.umd.js.map