ionic-logging-viewer 18.0.0 → 22.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.
- package/README.md +16 -14
- package/fesm2022/ionic-logging-viewer.mjs +167 -259
- package/fesm2022/ionic-logging-viewer.mjs.map +1 -1
- package/package.json +14 -12
- package/types/ionic-logging-viewer.d.ts +244 -0
- package/esm2022/ionic-logging-viewer.mjs +0 -5
- package/esm2022/lib/logging-viewer/logging-viewer.component.mjs +0 -119
- package/esm2022/lib/logging-viewer-filter.service.mjs +0 -64
- package/esm2022/lib/logging-viewer-levels/logging-viewer-levels.component.mjs +0 -71
- package/esm2022/lib/logging-viewer-modal/logging-viewer-modal-properties.model.mjs +0 -2
- package/esm2022/lib/logging-viewer-modal/logging-viewer-modal.component.mjs +0 -141
- package/esm2022/lib/logging-viewer-search/logging-viewer-search.component.mjs +0 -73
- package/esm2022/lib/logging-viewer-translation.model.mjs +0 -2
- package/esm2022/lib/logging-viewer.module.mjs +0 -53
- package/esm2022/public_api.mjs +0 -11
- package/index.d.ts +0 -5
- package/lib/logging-viewer/logging-viewer.component.d.ts +0 -73
- package/lib/logging-viewer-filter.service.d.ts +0 -47
- package/lib/logging-viewer-levels/logging-viewer-levels.component.d.ts +0 -44
- package/lib/logging-viewer-modal/logging-viewer-modal-properties.model.d.ts +0 -25
- package/lib/logging-viewer-modal/logging-viewer-modal.component.d.ts +0 -75
- package/lib/logging-viewer-search/logging-viewer-search.component.d.ts +0 -44
- package/lib/logging-viewer-translation.model.d.ts +0 -27
- package/lib/logging-viewer.module.d.ts +0 -13
- package/public_api.d.ts +0 -7
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { inject, signal, Injectable, input, computed, effect, Component } from '@angular/core';
|
|
3
|
+
import { LoggingService, LogLevelConverter } from 'ionic-logging-service';
|
|
4
|
+
import * as i1 from '@ionic/angular';
|
|
5
|
+
import { IonicModule, Platform, AlertController, ModalController } from '@ionic/angular';
|
|
6
|
+
import { DatePipe } from '@angular/common';
|
|
7
|
+
import * as i2 from '@angular/forms';
|
|
6
8
|
import { FormsModule } from '@angular/forms';
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import * as i1 from 'ionic-logging-service';
|
|
10
|
-
import { LogLevelConverter } from 'ionic-logging-service';
|
|
9
|
+
import { addIcons } from 'ionicons';
|
|
10
|
+
import { trashOutline, closeCircle } from 'ionicons/icons';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Service for storing filter settings for logging viewer.
|
|
@@ -18,56 +18,32 @@ class LoggingViewerFilterService {
|
|
|
18
18
|
*
|
|
19
19
|
* @param loggingService needed for internal logging.
|
|
20
20
|
*/
|
|
21
|
-
constructor(
|
|
22
|
-
this.
|
|
21
|
+
constructor() {
|
|
22
|
+
this.loggingService = inject(LoggingService);
|
|
23
|
+
/**
|
|
24
|
+
* Signal for the current log level.
|
|
25
|
+
*/
|
|
26
|
+
this.level = signal("DEBUG", /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "level" }] : /* istanbul ignore next */ []));
|
|
28
|
+
/**
|
|
29
|
+
* Signal for the current search value.
|
|
30
|
+
*/
|
|
31
|
+
this.search = signal("", /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []));
|
|
33
|
+
this.logger = this.loggingService.getLogger("Ionic.Logging.Viewer.Filter.Service");
|
|
23
34
|
const methodName = "ctor";
|
|
24
35
|
this.logger.entry(methodName);
|
|
25
|
-
this.levelValue = "DEBUG";
|
|
26
|
-
this.searchValue = "";
|
|
27
|
-
this.filterChanged = new EventEmitter();
|
|
28
36
|
this.logger.exit(methodName);
|
|
29
37
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
*
|
|
33
|
-
* @return log level
|
|
34
|
-
*/
|
|
35
|
-
get level() {
|
|
36
|
-
return this.levelValue;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Sets the new log level and emits a filterChanged event.
|
|
40
|
-
*
|
|
41
|
-
* @param value new slog level
|
|
42
|
-
*/
|
|
43
|
-
set level(value) {
|
|
44
|
-
this.levelValue = value;
|
|
45
|
-
this.filterChanged.emit();
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Gets the current search value.
|
|
49
|
-
*
|
|
50
|
-
* @return search value
|
|
51
|
-
*/
|
|
52
|
-
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
53
|
-
get search() {
|
|
54
|
-
return this.searchValue;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Sets the new search value and emits a filterChanged event.
|
|
58
|
-
*
|
|
59
|
-
* @param value new search value
|
|
60
|
-
*/
|
|
61
|
-
set search(value) {
|
|
62
|
-
this.searchValue = value;
|
|
63
|
-
this.filterChanged.emit();
|
|
64
|
-
}
|
|
65
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: LoggingViewerFilterService, deps: [{ token: i1.LoggingService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
66
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: LoggingViewerFilterService }); }
|
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerFilterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
39
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerFilterService, providedIn: 'root' }); }
|
|
67
40
|
}
|
|
68
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
69
|
-
type: Injectable
|
|
70
|
-
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerFilterService, decorators: [{
|
|
42
|
+
type: Injectable,
|
|
43
|
+
args: [{
|
|
44
|
+
providedIn: 'root'
|
|
45
|
+
}]
|
|
46
|
+
}], ctorParameters: () => [] });
|
|
71
47
|
|
|
72
48
|
/**
|
|
73
49
|
* Component for displaying the current logs.
|
|
@@ -80,52 +56,50 @@ class LoggingViewerComponent {
|
|
|
80
56
|
/**
|
|
81
57
|
* Creates a new instance of the component.
|
|
82
58
|
*/
|
|
83
|
-
constructor(
|
|
84
|
-
this.loggingService =
|
|
85
|
-
this.loggingViewerFilterService =
|
|
86
|
-
|
|
59
|
+
constructor() {
|
|
60
|
+
this.loggingService = inject(LoggingService);
|
|
61
|
+
this.loggingViewerFilterService = inject(LoggingViewerFilterService);
|
|
62
|
+
/**
|
|
63
|
+
* Comma-separated list of localStorageKeys. If set, the logs get loaded from localStorage instead of memory.
|
|
64
|
+
*/
|
|
65
|
+
this.localStorageKeys = input(undefined, /* @ts-ignore */
|
|
66
|
+
...(ngDevMode ? [{ debugName: "localStorageKeys" }] : /* istanbul ignore next */ []));
|
|
67
|
+
/**
|
|
68
|
+
* Log messages which fulfill the filter condition.
|
|
69
|
+
*/
|
|
70
|
+
this.logMessagesForDisplay = signal([], /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "logMessagesForDisplay" }] : /* istanbul ignore next */ []));
|
|
72
|
+
this.logMessages = computed(() => {
|
|
73
|
+
const localStorageKeys = this.localStorageKeys();
|
|
74
|
+
if (localStorageKeys) {
|
|
75
|
+
let messages = [];
|
|
76
|
+
for (const localStorageKey of localStorageKeys.split(",")) {
|
|
77
|
+
messages = messages.concat(this.loggingService.getLogMessagesFromLocalStorage(localStorageKey));
|
|
78
|
+
}
|
|
79
|
+
return messages.sort((a, b) => a.timeStamp.getTime() - b.timeStamp.getTime());
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
return this.loggingService.getLogMessages()();
|
|
83
|
+
}
|
|
84
|
+
}, /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "logMessages" }] : /* istanbul ignore next */ []));
|
|
86
|
+
this.logger = this.loggingService.getLogger("Ionic.Logging.Viewer.Component");
|
|
87
87
|
const methodName = "ctor";
|
|
88
88
|
this.logger.entry(methodName);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
* and the log messages from [LoggingService](../../../ionic-logging-service/typedoc/index.html).
|
|
96
|
-
* If the localStorageKeys property is set, the messages are read from local storage.
|
|
97
|
-
*/
|
|
98
|
-
ngOnInit() {
|
|
99
|
-
const methodName = "ngOnInit";
|
|
100
|
-
this.logger.entry(methodName);
|
|
101
|
-
this.loadLogMessages();
|
|
102
|
-
this.filterLogMessages();
|
|
103
|
-
// subscribe to loggingService.logMessagesChanged event, to refresh, when new message is logged
|
|
104
|
-
this.logMessagesChangedSubscription = this.loggingService.logMessagesChanged.subscribe(async () => {
|
|
105
|
-
this.loadLogMessages();
|
|
106
|
-
this.filterLogMessages();
|
|
89
|
+
// refresh the messages, when messages or filter are modified
|
|
90
|
+
effect(() => {
|
|
91
|
+
const logMessages = this.logMessages();
|
|
92
|
+
const level = this.loggingViewerFilterService.level();
|
|
93
|
+
const search = this.loggingViewerFilterService.search();
|
|
94
|
+
this.filterLogMessages(logMessages, level, search);
|
|
107
95
|
});
|
|
108
|
-
// subscribe to loggingViewerFilterService.filterChanged event, to refresh, when filter is modified
|
|
109
|
-
this.filterChangedSubscription = this.loggingViewerFilterService.filterChanged.subscribe(() => {
|
|
110
|
-
this.filterLogMessages();
|
|
111
|
-
});
|
|
112
|
-
this.logger.exit(methodName);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Clean up.
|
|
116
|
-
*/
|
|
117
|
-
ngOnDestroy() {
|
|
118
|
-
const methodName = "ngOnDestroy";
|
|
119
|
-
this.logger.entry(methodName);
|
|
120
|
-
this.logMessagesChangedSubscription.unsubscribe();
|
|
121
|
-
this.filterChangedSubscription.unsubscribe();
|
|
122
96
|
this.logger.exit(methodName);
|
|
123
97
|
}
|
|
124
98
|
/**
|
|
125
99
|
* Filter the log messages.
|
|
126
100
|
*/
|
|
127
|
-
filterLogMessages() {
|
|
128
|
-
this.logMessagesForDisplay
|
|
101
|
+
filterLogMessages(logMessages, level, search) {
|
|
102
|
+
this.logMessagesForDisplay.set(logMessages.filter((message) => this.filterLogMessagesByLevel(message, level) && this.filterLogMessagesBySearch(message, search)));
|
|
129
103
|
}
|
|
130
104
|
/**
|
|
131
105
|
* Check if the log message's level fulfills the level condition.
|
|
@@ -133,9 +107,8 @@ class LoggingViewerComponent {
|
|
|
133
107
|
* @param message the log message to check
|
|
134
108
|
* @returns true if check was successful
|
|
135
109
|
*/
|
|
136
|
-
filterLogMessagesByLevel(message) {
|
|
137
|
-
|
|
138
|
-
return LogLevelConverter.levelFromString(message.level) >= LogLevelConverter.levelFromString(levelValue);
|
|
110
|
+
filterLogMessagesByLevel(message, level) {
|
|
111
|
+
return LogLevelConverter.levelFromString(message.level) >= LogLevelConverter.levelFromString(level);
|
|
139
112
|
}
|
|
140
113
|
/**
|
|
141
114
|
* Check if the log message fulfills the search condition.
|
|
@@ -148,37 +121,22 @@ class LoggingViewerComponent {
|
|
|
148
121
|
* @param message the log message to check
|
|
149
122
|
* @returns true if check was successful
|
|
150
123
|
*/
|
|
151
|
-
filterLogMessagesBySearch(message) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
message.methodName.search(searchValue) >= 0 ||
|
|
155
|
-
message.message.join("|").search(searchValue) >= 0;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Load the current log messages.
|
|
159
|
-
* For unit test purposes mainly.
|
|
160
|
-
*/
|
|
161
|
-
loadLogMessages() {
|
|
162
|
-
if (this.localStorageKeys) {
|
|
163
|
-
this.logMessages = [];
|
|
164
|
-
for (const localStorageKey of this.localStorageKeys.split(",")) {
|
|
165
|
-
this.logMessages = this.logMessages.concat(this.loggingService.getLogMessagesFromLocalStorage(localStorageKey));
|
|
166
|
-
}
|
|
167
|
-
this.logMessages = this.logMessages.sort((a, b) => a.timeStamp.getTime() - b.timeStamp.getTime());
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
this.logMessages = this.loggingService.getLogMessages();
|
|
124
|
+
filterLogMessagesBySearch(message, search) {
|
|
125
|
+
if (!message.logger || !message.methodName || !message.message) {
|
|
126
|
+
return false;
|
|
171
127
|
}
|
|
128
|
+
const searchRegex = new RegExp(search, "i");
|
|
129
|
+
return message.logger.search(searchRegex) >= 0 ||
|
|
130
|
+
message.methodName.search(searchRegex) >= 0 ||
|
|
131
|
+
message.message.join("|").search(searchRegex) >= 0;
|
|
172
132
|
}
|
|
173
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
174
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
133
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
134
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: LoggingViewerComponent, isStandalone: true, selector: "ionic-logging-viewer", inputs: { localStorageKeys: { classPropertyName: "localStorageKeys", publicName: "localStorageKeys", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ion-list>\n @for (logMessage of logMessagesForDisplay(); track logMessage) {\n <ion-item>\n <ion-label>\n <p>{{ logMessage.timeStamp | date:'dd.MM.yyyy HH:mm:ss' }} {{ logMessage.level }}</p>\n <p>{{ logMessage.logger }}</p>\n <p>\n {{ logMessage.methodName }}\n @for (messagePart of logMessage.message; track messagePart) {\n <span> {{ messagePart }} </span>\n }\n </p>\n </ion-label>\n </ion-item>\n }\n</ion-list>", styles: [""], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonItem, selector: "ion-item", inputs: ["button", "color", "detail", "detailIcon", "disabled", "download", "href", "lines", "mode", "rel", "routerAnimation", "routerDirection", "target", "type"] }, { kind: "component", type: i1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i1.IonList, selector: "ion-list", inputs: ["inset", "lines", "mode"] }, { kind: "pipe", type: DatePipe, name: "date" }] }); }
|
|
175
135
|
}
|
|
176
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerComponent, decorators: [{
|
|
177
137
|
type: Component,
|
|
178
|
-
args: [{ selector: "ionic-logging-viewer", template: "<ion-list>\n
|
|
179
|
-
}], ctorParameters: () => [{ type:
|
|
180
|
-
type: Input
|
|
181
|
-
}] } });
|
|
138
|
+
args: [{ selector: "ionic-logging-viewer", imports: [IonicModule, DatePipe], template: "<ion-list>\n @for (logMessage of logMessagesForDisplay(); track logMessage) {\n <ion-item>\n <ion-label>\n <p>{{ logMessage.timeStamp | date:'dd.MM.yyyy HH:mm:ss' }} {{ logMessage.level }}</p>\n <p>{{ logMessage.logger }}</p>\n <p>\n {{ logMessage.methodName }}\n @for (messagePart of logMessage.message; track messagePart) {\n <span> {{ messagePart }} </span>\n }\n </p>\n </ion-label>\n </ion-item>\n }\n</ion-list>" }]
|
|
139
|
+
}], ctorParameters: () => [], propDecorators: { localStorageKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "localStorageKeys", required: false }] }] } });
|
|
182
140
|
|
|
183
141
|
/**
|
|
184
142
|
* Component for displaying the log levels for filtering the current logs.
|
|
@@ -191,56 +149,42 @@ class LoggingViewerLevelsComponent {
|
|
|
191
149
|
/**
|
|
192
150
|
* Creates a new instance of the component.
|
|
193
151
|
*/
|
|
194
|
-
constructor(
|
|
195
|
-
this.
|
|
196
|
-
this.
|
|
152
|
+
constructor() {
|
|
153
|
+
this.loggingService = inject(LoggingService);
|
|
154
|
+
this.loggingViewerFilterService = inject(LoggingViewerFilterService);
|
|
155
|
+
/**
|
|
156
|
+
* Selected level.
|
|
157
|
+
*/
|
|
158
|
+
this.selectedLevel = "";
|
|
159
|
+
this.logger = this.loggingService.getLogger("Ionic.Logging.Viewer.Levels.Component");
|
|
197
160
|
const methodName = "ctor";
|
|
198
161
|
this.logger.entry(methodName);
|
|
199
162
|
this.logLevels = [];
|
|
200
163
|
this.logLevels.push("DEBUG", "INFO", "WARN", "ERROR");
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Initialize the component.
|
|
205
|
-
*
|
|
206
|
-
* This is done by reading the filter data from [LoggingViewerFilterService](LoggingViewerFilterService.html).
|
|
207
|
-
*/
|
|
208
|
-
ngOnInit() {
|
|
209
|
-
const methodName = "ngOnInit";
|
|
210
|
-
this.logger.entry(methodName);
|
|
211
|
-
this.selectedLevel = this.loggingViewerFilterService.level;
|
|
212
|
-
// subscribe to loggingViewerFilterService.filterChanged event, to refresh,
|
|
164
|
+
// handle signals of loggingViewerFilterService, to refresh,
|
|
213
165
|
// when someone else modifies the level
|
|
214
|
-
|
|
215
|
-
|
|
166
|
+
effect(() => {
|
|
167
|
+
const level = this.loggingViewerFilterService.level();
|
|
168
|
+
this.selectedLevel = level;
|
|
216
169
|
});
|
|
217
170
|
this.logger.exit(methodName);
|
|
218
171
|
}
|
|
219
|
-
/**
|
|
220
|
-
* Clean up.
|
|
221
|
-
*/
|
|
222
|
-
ngOnDestroy() {
|
|
223
|
-
const methodName = "ngOnDestroy";
|
|
224
|
-
this.logger.entry(methodName);
|
|
225
|
-
this.filterChangedSubscription.unsubscribe();
|
|
226
|
-
this.logger.exit(methodName);
|
|
227
|
-
}
|
|
228
172
|
/**
|
|
229
173
|
* Callback when the level was changed in the UI.
|
|
230
174
|
*/
|
|
231
175
|
onLevelChanged() {
|
|
232
176
|
const methodName = "onLevelChanged";
|
|
233
177
|
this.logger.entry(methodName, this.selectedLevel);
|
|
234
|
-
this.loggingViewerFilterService.level
|
|
178
|
+
this.loggingViewerFilterService.level.set(this.selectedLevel);
|
|
235
179
|
this.logger.exit(methodName);
|
|
236
180
|
}
|
|
237
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
238
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
181
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerLevelsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
182
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: LoggingViewerLevelsComponent, isStandalone: true, selector: "ionic-logging-viewer-levels", ngImport: i0, template: "<ion-segment [(ngModel)]=\"selectedLevel\" (ionChange)=\"onLevelChanged()\">\n @for (logLevel of logLevels; track logLevel) {\n <ion-segment-button [value]=\"logLevel\">\n <ion-label>{{ logLevel }}</ion-label>\n </ion-segment-button>\n }\n</ion-segment>", styles: [""], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonLabel, selector: "ion-label", inputs: ["color", "mode", "position"] }, { kind: "component", type: i1.IonSegment, selector: "ion-segment", inputs: ["color", "disabled", "mode", "scrollable", "selectOnFocus", "swipeGesture", "value"] }, { kind: "component", type: i1.IonSegmentButton, selector: "ion-segment-button", inputs: ["contentId", "disabled", "layout", "mode", "type", "value"] }, { kind: "directive", type: i1.SelectValueAccessor, selector: "ion-select, ion-radio-group, ion-segment, ion-datetime" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
239
183
|
}
|
|
240
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerLevelsComponent, decorators: [{
|
|
241
185
|
type: Component,
|
|
242
|
-
args: [{ selector: "ionic-logging-viewer-levels", template: "<ion-segment [(ngModel)]=\"selectedLevel\" (ionChange)=\"onLevelChanged()\">\n\
|
|
243
|
-
}], ctorParameters: () => [
|
|
186
|
+
args: [{ selector: "ionic-logging-viewer-levels", imports: [IonicModule, FormsModule], template: "<ion-segment [(ngModel)]=\"selectedLevel\" (ionChange)=\"onLevelChanged()\">\n @for (logLevel of logLevels; track logLevel) {\n <ion-segment-button [value]=\"logLevel\">\n <ion-label>{{ logLevel }}</ion-label>\n </ion-segment-button>\n }\n</ion-segment>" }]
|
|
187
|
+
}], ctorParameters: () => [] });
|
|
244
188
|
|
|
245
189
|
/**
|
|
246
190
|
* Component for displaying the search bar for filtering the current logs.
|
|
@@ -253,59 +197,45 @@ class LoggingViewerSearchComponent {
|
|
|
253
197
|
/**
|
|
254
198
|
* Creates a new instance of the component.
|
|
255
199
|
*/
|
|
256
|
-
constructor(
|
|
257
|
-
this.
|
|
258
|
-
this.
|
|
200
|
+
constructor() {
|
|
201
|
+
this.loggingService = inject(LoggingService);
|
|
202
|
+
this.loggingViewerFilterService = inject(LoggingViewerFilterService);
|
|
203
|
+
/**
|
|
204
|
+
* Placeholder to be shown in the empty search bar.
|
|
205
|
+
*/
|
|
206
|
+
this.placeholder = input(undefined, /* @ts-ignore */
|
|
207
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
208
|
+
/**
|
|
209
|
+
* Current search value.
|
|
210
|
+
*/
|
|
211
|
+
this.search = "";
|
|
212
|
+
this.logger = this.loggingService.getLogger("Ionic.Logging.Viewer.Search.Component");
|
|
259
213
|
const methodName = "ctor";
|
|
260
214
|
this.logger.entry(methodName);
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Initialize the component.
|
|
265
|
-
*
|
|
266
|
-
* This is done by reading the filter data from [LoggingViewerFilterService](LoggingViewerFilterService.html).
|
|
267
|
-
*/
|
|
268
|
-
ngOnInit() {
|
|
269
|
-
const methodName = "ngOnInit";
|
|
270
|
-
this.logger.entry(methodName);
|
|
271
|
-
if (!this.placeholder) {
|
|
272
|
-
this.placeholder = "Search";
|
|
273
|
-
}
|
|
274
|
-
this.search = this.loggingViewerFilterService.search;
|
|
275
|
-
// subscribe to loggingViewerFilterService.filterChanged event, to refresh,
|
|
215
|
+
// handle signals of loggingViewerFilterService, to refresh,
|
|
276
216
|
// when someone else modifies the search value
|
|
277
|
-
|
|
278
|
-
|
|
217
|
+
effect(() => {
|
|
218
|
+
const search = this.loggingViewerFilterService.search();
|
|
219
|
+
this.search = search;
|
|
279
220
|
});
|
|
280
221
|
this.logger.exit(methodName);
|
|
281
222
|
}
|
|
282
|
-
/**
|
|
283
|
-
* Clean up.
|
|
284
|
-
*/
|
|
285
|
-
ngOnDestroy() {
|
|
286
|
-
const methodName = "ngOnDestroy";
|
|
287
|
-
this.logger.entry(methodName);
|
|
288
|
-
this.filterChangedSubscription.unsubscribe();
|
|
289
|
-
this.logger.exit(methodName);
|
|
290
|
-
}
|
|
291
223
|
/**
|
|
292
224
|
* Callback when the search value was changed in the UI.
|
|
293
225
|
*/
|
|
294
226
|
onSearchChanged() {
|
|
295
227
|
const methodName = "onSearchChanged";
|
|
296
228
|
this.logger.entry(methodName, this.search);
|
|
297
|
-
this.loggingViewerFilterService.search
|
|
229
|
+
this.loggingViewerFilterService.search.set(this.search);
|
|
298
230
|
this.logger.exit(methodName);
|
|
299
231
|
}
|
|
300
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
301
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
232
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerSearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
233
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.0", type: LoggingViewerSearchComponent, isStandalone: true, selector: "ionic-logging-viewer-search", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ion-searchbar placeholder=\"{{placeholder() || 'Search'}}\" [(ngModel)]=\"search\" [debounce]=\"1000\"\n (ionInput)=\"onSearchChanged()\"></ion-searchbar>", styles: ["ion-searchbar{padding-top:3px;padding-bottom:0}\n"], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonSearchbar, selector: "ion-searchbar", inputs: ["animated", "autocapitalize", "autocomplete", "autocorrect", "cancelButtonIcon", "cancelButtonText", "clearIcon", "color", "debounce", "disabled", "enterkeyhint", "inputmode", "maxlength", "minlength", "mode", "name", "placeholder", "searchIcon", "showCancelButton", "showClearButton", "spellcheck", "type", "value"] }, { kind: "directive", type: i1.TextValueAccessor, selector: "ion-input:not([type=number]),ion-input-otp[type=text],ion-textarea,ion-searchbar" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] }); }
|
|
302
234
|
}
|
|
303
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
235
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerSearchComponent, decorators: [{
|
|
304
236
|
type: Component,
|
|
305
|
-
args: [{ selector: "ionic-logging-viewer-search", template: "<ion-searchbar placeholder=\"{{placeholder}}\" [(ngModel)]=\"search\" (
|
|
306
|
-
}], ctorParameters: () => [{ type:
|
|
307
|
-
type: Input
|
|
308
|
-
}] } });
|
|
237
|
+
args: [{ selector: "ionic-logging-viewer-search", imports: [IonicModule, FormsModule], template: "<ion-searchbar placeholder=\"{{placeholder() || 'Search'}}\" [(ngModel)]=\"search\" [debounce]=\"1000\"\n (ionInput)=\"onSearchChanged()\"></ion-searchbar>", styles: ["ion-searchbar{padding-top:3px;padding-bottom:0}\n"] }]
|
|
238
|
+
}], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
|
|
309
239
|
|
|
310
240
|
/**
|
|
311
241
|
* Ionic modal containing [LoggingViewerComponent](LoggingViewerComponent.html),
|
|
@@ -318,14 +248,40 @@ class LoggingViewerModalComponent {
|
|
|
318
248
|
/**
|
|
319
249
|
* Creates a new instance of the component.
|
|
320
250
|
*/
|
|
321
|
-
constructor(
|
|
322
|
-
this.
|
|
323
|
-
this.
|
|
324
|
-
this.
|
|
325
|
-
this.
|
|
251
|
+
constructor() {
|
|
252
|
+
this.platform = inject(Platform);
|
|
253
|
+
this.alertController = inject(AlertController);
|
|
254
|
+
this.modalController = inject(ModalController);
|
|
255
|
+
this.loggingService = inject(LoggingService);
|
|
256
|
+
/**
|
|
257
|
+
* Language to be used for the modal.
|
|
258
|
+
* Currently supported: en, de
|
|
259
|
+
*/
|
|
260
|
+
this.language = input(undefined, /* @ts-ignore */
|
|
261
|
+
...(ngDevMode ? [{ debugName: "language" }] : /* istanbul ignore next */ []));
|
|
262
|
+
/**
|
|
263
|
+
* Translation to be used for the modal.
|
|
264
|
+
* If specified, the language is ignored.
|
|
265
|
+
*/
|
|
266
|
+
this.translation = input(undefined, /* @ts-ignore */
|
|
267
|
+
...(ngDevMode ? [{ debugName: "translation" }] : /* istanbul ignore next */ []));
|
|
268
|
+
/**
|
|
269
|
+
* Comma-separated list of localStorageKeys. If set, the logs get loaded from localStorage instead of memory.
|
|
270
|
+
*/
|
|
271
|
+
this.localStorageKeys = input(undefined, /* @ts-ignore */
|
|
272
|
+
...(ngDevMode ? [{ debugName: "localStorageKeys" }] : /* istanbul ignore next */ []));
|
|
273
|
+
/**
|
|
274
|
+
* Flag showing a delete button, which removes all existing log messages.
|
|
275
|
+
*/
|
|
276
|
+
this.allowClearLogs = input(true, /* @ts-ignore */
|
|
277
|
+
...(ngDevMode ? [{ debugName: "allowClearLogs" }] : /* istanbul ignore next */ []));
|
|
278
|
+
this.translations = {};
|
|
279
|
+
this.logger = this.
|
|
280
|
+
loggingService.getLogger("Ionic.Logging.Viewer.Modal.Component");
|
|
326
281
|
const methodName = "ctor";
|
|
327
282
|
this.logger.entry(methodName);
|
|
328
|
-
this.isAndroid = platform.is("android");
|
|
283
|
+
this.isAndroid = this.platform.is("android");
|
|
284
|
+
addIcons({ closeCircle, trashOutline });
|
|
329
285
|
this.logger.exit(methodName);
|
|
330
286
|
}
|
|
331
287
|
/**
|
|
@@ -396,8 +352,9 @@ class LoggingViewerModalComponent {
|
|
|
396
352
|
* Clear logs.
|
|
397
353
|
*/
|
|
398
354
|
clearLogs() {
|
|
399
|
-
|
|
400
|
-
|
|
355
|
+
const localStorageKeys = this.localStorageKeys();
|
|
356
|
+
if (localStorageKeys) {
|
|
357
|
+
for (const localStorageKey of localStorageKeys.split(",")) {
|
|
401
358
|
this.loggingService.removeLogMessagesFromLocalStorage(localStorageKey);
|
|
402
359
|
}
|
|
403
360
|
}
|
|
@@ -412,74 +369,25 @@ class LoggingViewerModalComponent {
|
|
|
412
369
|
* - English translation, otherwise
|
|
413
370
|
*/
|
|
414
371
|
getTranslation() {
|
|
415
|
-
|
|
416
|
-
|
|
372
|
+
const language = this.language();
|
|
373
|
+
const translation = this.translation();
|
|
374
|
+
if (typeof translation !== "undefined") {
|
|
375
|
+
return translation;
|
|
417
376
|
}
|
|
418
|
-
else if (typeof
|
|
419
|
-
return this.translations[
|
|
377
|
+
else if (typeof language !== "undefined" && typeof this.translations[language] === "object") {
|
|
378
|
+
return this.translations[language];
|
|
420
379
|
}
|
|
421
380
|
else {
|
|
422
381
|
return this.translations[LoggingViewerModalComponent.languageEn];
|
|
423
382
|
}
|
|
424
383
|
}
|
|
425
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
426
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
384
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
385
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.0", type: LoggingViewerModalComponent, isStandalone: true, selector: "ionic-logging-viewer-modal", inputs: { language: { classPropertyName: "language", publicName: "language", isSignal: true, isRequired: false, transformFunction: null }, translation: { classPropertyName: "translation", publicName: "translation", isSignal: true, isRequired: false, transformFunction: null }, localStorageKeys: { classPropertyName: "localStorageKeys", publicName: "localStorageKeys", isSignal: true, isRequired: false, transformFunction: null }, allowClearLogs: { classPropertyName: "allowClearLogs", publicName: "allowClearLogs", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<ion-header>\n <ion-toolbar color=primary>\n <ion-title>{{ getTranslation().title }}</ion-title>\n <ion-buttons slot=\"start\">\n @if (!isAndroid) {\n <ion-button (click)=\"onClose()\">\n {{ getTranslation().cancel }}\n </ion-button>\n } @else {\n <ion-button icon-only (click)=\"onClose()\">\n <ion-icon name=\"close-circle\"></ion-icon>\n </ion-button>\n }\n </ion-buttons>\n </ion-toolbar>\n <ion-toolbar>\n <ionic-logging-viewer-search [placeholder]=\"getTranslation().searchPlaceholder\"></ionic-logging-viewer-search>\n @if (allowClearLogs() !== false) {\n <ion-buttons slot=\"end\" class=\"clearLogs\">\n <ion-button (click)=\"onClearLogs()\">\n <ion-icon name=\"trash-outline\"></ion-icon>\n </ion-button>\n </ion-buttons>\n }\n </ion-toolbar>\n <ion-toolbar>\n <ionic-logging-viewer-levels></ionic-logging-viewer-levels>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <ionic-logging-viewer [localStorageKeys]=\"localStorageKeys()\"></ionic-logging-viewer>\n</ion-content>", styles: ["ionic-logging-viewer-levels{width:100%;padding-left:12px;padding-right:12px}.clearLogs{padding-top:3px}\n"], dependencies: [{ kind: "ngmodule", type: IonicModule }, { kind: "component", type: i1.IonButton, selector: "ion-button", inputs: ["buttonType", "color", "disabled", "download", "expand", "fill", "form", "href", "mode", "rel", "routerAnimation", "routerDirection", "shape", "size", "strong", "target", "type"] }, { kind: "component", type: i1.IonButtons, selector: "ion-buttons", inputs: ["collapse"] }, { kind: "component", type: i1.IonContent, selector: "ion-content", inputs: ["color", "fixedSlotPlacement", "forceOverscroll", "fullscreen", "scrollEvents", "scrollX", "scrollY"] }, { kind: "component", type: i1.IonHeader, selector: "ion-header", inputs: ["collapse", "mode", "translucent"] }, { kind: "component", type: i1.IonIcon, selector: "ion-icon", inputs: ["color", "flipRtl", "icon", "ios", "lazy", "md", "mode", "name", "sanitize", "size", "src"] }, { kind: "component", type: i1.IonTitle, selector: "ion-title", inputs: ["color", "size"] }, { kind: "component", type: i1.IonToolbar, selector: "ion-toolbar", inputs: ["color", "mode"] }, { kind: "component", type: LoggingViewerSearchComponent, selector: "ionic-logging-viewer-search", inputs: ["placeholder"] }, { kind: "component", type: LoggingViewerLevelsComponent, selector: "ionic-logging-viewer-levels" }, { kind: "component", type: LoggingViewerComponent, selector: "ionic-logging-viewer", inputs: ["localStorageKeys"] }] }); }
|
|
427
386
|
}
|
|
428
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.0", ngImport: i0, type: LoggingViewerModalComponent, decorators: [{
|
|
429
388
|
type: Component,
|
|
430
|
-
args: [{ selector: "ionic-logging-viewer-modal", template: "<ion-header>\n
|
|
431
|
-
}], ctorParameters: () => [{ type:
|
|
432
|
-
type: Input
|
|
433
|
-
}], translation: [{
|
|
434
|
-
type: Input
|
|
435
|
-
}], localStorageKeys: [{
|
|
436
|
-
type: Input
|
|
437
|
-
}], allowClearLogs: [{
|
|
438
|
-
type: Input
|
|
439
|
-
}] } });
|
|
440
|
-
|
|
441
|
-
class LoggingViewerModule {
|
|
442
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: LoggingViewerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
443
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.2.2", ngImport: i0, type: LoggingViewerModule, declarations: [LoggingViewerComponent,
|
|
444
|
-
LoggingViewerSearchComponent,
|
|
445
|
-
LoggingViewerLevelsComponent,
|
|
446
|
-
LoggingViewerModalComponent], imports: [CommonModule,
|
|
447
|
-
FormsModule,
|
|
448
|
-
IonicModule], exports: [LoggingViewerComponent,
|
|
449
|
-
LoggingViewerSearchComponent,
|
|
450
|
-
LoggingViewerLevelsComponent,
|
|
451
|
-
LoggingViewerModalComponent] }); }
|
|
452
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: LoggingViewerModule, providers: [
|
|
453
|
-
LoggingViewerFilterService
|
|
454
|
-
], imports: [CommonModule,
|
|
455
|
-
FormsModule,
|
|
456
|
-
IonicModule] }); }
|
|
457
|
-
}
|
|
458
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.2", ngImport: i0, type: LoggingViewerModule, decorators: [{
|
|
459
|
-
type: NgModule,
|
|
460
|
-
args: [{
|
|
461
|
-
imports: [
|
|
462
|
-
CommonModule,
|
|
463
|
-
FormsModule,
|
|
464
|
-
IonicModule
|
|
465
|
-
],
|
|
466
|
-
declarations: [
|
|
467
|
-
LoggingViewerComponent,
|
|
468
|
-
LoggingViewerSearchComponent,
|
|
469
|
-
LoggingViewerLevelsComponent,
|
|
470
|
-
LoggingViewerModalComponent
|
|
471
|
-
],
|
|
472
|
-
exports: [
|
|
473
|
-
LoggingViewerComponent,
|
|
474
|
-
LoggingViewerSearchComponent,
|
|
475
|
-
LoggingViewerLevelsComponent,
|
|
476
|
-
LoggingViewerModalComponent
|
|
477
|
-
],
|
|
478
|
-
providers: [
|
|
479
|
-
LoggingViewerFilterService
|
|
480
|
-
]
|
|
481
|
-
}]
|
|
482
|
-
}] });
|
|
389
|
+
args: [{ selector: "ionic-logging-viewer-modal", imports: [IonicModule, LoggingViewerSearchComponent, LoggingViewerLevelsComponent, LoggingViewerComponent], template: "<ion-header>\n <ion-toolbar color=primary>\n <ion-title>{{ getTranslation().title }}</ion-title>\n <ion-buttons slot=\"start\">\n @if (!isAndroid) {\n <ion-button (click)=\"onClose()\">\n {{ getTranslation().cancel }}\n </ion-button>\n } @else {\n <ion-button icon-only (click)=\"onClose()\">\n <ion-icon name=\"close-circle\"></ion-icon>\n </ion-button>\n }\n </ion-buttons>\n </ion-toolbar>\n <ion-toolbar>\n <ionic-logging-viewer-search [placeholder]=\"getTranslation().searchPlaceholder\"></ionic-logging-viewer-search>\n @if (allowClearLogs() !== false) {\n <ion-buttons slot=\"end\" class=\"clearLogs\">\n <ion-button (click)=\"onClearLogs()\">\n <ion-icon name=\"trash-outline\"></ion-icon>\n </ion-button>\n </ion-buttons>\n }\n </ion-toolbar>\n <ion-toolbar>\n <ionic-logging-viewer-levels></ionic-logging-viewer-levels>\n </ion-toolbar>\n</ion-header>\n<ion-content>\n <ionic-logging-viewer [localStorageKeys]=\"localStorageKeys()\"></ionic-logging-viewer>\n</ion-content>", styles: ["ionic-logging-viewer-levels{width:100%;padding-left:12px;padding-right:12px}.clearLogs{padding-top:3px}\n"] }]
|
|
390
|
+
}], ctorParameters: () => [], propDecorators: { language: [{ type: i0.Input, args: [{ isSignal: true, alias: "language", required: false }] }], translation: [{ type: i0.Input, args: [{ isSignal: true, alias: "translation", required: false }] }], localStorageKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "localStorageKeys", required: false }] }], allowClearLogs: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowClearLogs", required: false }] }] } });
|
|
483
391
|
|
|
484
392
|
/*
|
|
485
393
|
* Public API Surface of ionic-logging-viewer
|
|
@@ -489,5 +397,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.2.2", ngImpor
|
|
|
489
397
|
* Generated bundle index. Do not edit.
|
|
490
398
|
*/
|
|
491
399
|
|
|
492
|
-
export { LoggingViewerComponent, LoggingViewerLevelsComponent, LoggingViewerModalComponent,
|
|
400
|
+
export { LoggingViewerComponent, LoggingViewerLevelsComponent, LoggingViewerModalComponent, LoggingViewerSearchComponent };
|
|
493
401
|
//# sourceMappingURL=ionic-logging-viewer.mjs.map
|