ionic-logging-viewer
Version:
Viewer component for logs written by ionic-logging-service
245 lines (237 loc) • 8.25 kB
TypeScript
import * as i0 from '@angular/core';
import { OnInit } from '@angular/core';
import { LogMessage } from 'ionic-logging-service';
/**
* Component for displaying the current logs.
*
* The component can be embedded in any web page using:
*
* <ionic-logging-viewer></ionic-logging-viewer>
*/
declare class LoggingViewerComponent {
private loggingService;
private loggingViewerFilterService;
/**
* Comma-separated list of localStorageKeys. If set, the logs get loaded from localStorage instead of memory.
*/
readonly localStorageKeys: i0.InputSignal<string | undefined>;
/**
* Log messages which fulfill the filter condition.
*/
logMessagesForDisplay: i0.WritableSignal<LogMessage[]>;
private logger;
private logMessages;
/**
* Creates a new instance of the component.
*/
constructor();
/**
* Filter the log messages.
*/
filterLogMessages(logMessages: LogMessage[], level: string, search: string): void;
/**
* Check if the log message's level fulfills the level condition.
*
* @param message the log message to check
* @returns true if check was successful
*/
filterLogMessagesByLevel(message: LogMessage, level: string): boolean;
/**
* Check if the log message fulfills the search condition.
*
* The search value gets searched in:
* - logger name
* - method name
* - message
*
* @param message the log message to check
* @returns true if check was successful
*/
filterLogMessagesBySearch(message: LogMessage, search: string): boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<LoggingViewerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LoggingViewerComponent, "ionic-logging-viewer", never, { "localStorageKeys": { "alias": "localStorageKeys"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}
/**
* Component for displaying the log levels for filtering the current logs.
*
* The component can be embedded in any web page using:
*
* <ionic-logging-viewer-levels></ionic-logging-viewer-levels>
*/
declare class LoggingViewerLevelsComponent {
private loggingService;
private loggingViewerFilterService;
/**
* Log levels used for filtering: DEBUG, INFO, WARN, ERROR
*/
logLevels: string[];
/**
* Selected level.
*/
selectedLevel: string;
private logger;
/**
* Creates a new instance of the component.
*/
constructor();
/**
* Callback when the level was changed in the UI.
*/
onLevelChanged(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<LoggingViewerLevelsComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LoggingViewerLevelsComponent, "ionic-logging-viewer-levels", never, {}, {}, never, never, true, never>;
}
/**
* Component for displaying the search bar for filtering the current logs.
*
* The component can be embedded in any web page using:
*
* <ionic-logging-viewer-search placeholder="Search"></ionic-logging-viewer-search>
*/
declare class LoggingViewerSearchComponent {
private loggingService;
private loggingViewerFilterService;
/**
* Placeholder to be shown in the empty search bar.
*/
readonly placeholder: i0.InputSignal<string | undefined>;
/**
* Current search value.
*/
search: string;
private logger;
/**
* Creates a new instance of the component.
*/
constructor();
/**
* Callback when the search value was changed in the UI.
*/
onSearchChanged(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<LoggingViewerSearchComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LoggingViewerSearchComponent, "ionic-logging-viewer-search", never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}
/**
* Describes all values needed in a translation for
* [LoggingViewerModalComponent](../classes/LoggingViewerModalComponent.html).
*/
interface LoggingViewerTranslation {
/**
* Title of the modal.
*/
title: string;
/**
* Cancel button.
* There are two cancel buttons: in the modal itself (iOS only) and the confirmation for deleting the messages.
*/
cancel: string;
/**
* Ok button.
*/
ok: string;
/**
* Placeholder for search bar.
*/
searchPlaceholder: string;
/**
* Confirmation message for deleting log messages.
*/
confirmDelete: string;
}
/**
* Ionic modal containing [LoggingViewerComponent](LoggingViewerComponent.html),
* [LoggingViewerLevelsComponent](LoggingViewerLevelsComponent.html) and
* [LoggingViewerSearchComponent](LoggingViewerSearchComponent.html).
*/
declare class LoggingViewerModalComponent implements OnInit {
private platform;
private alertController;
private modalController;
private loggingService;
private static languageEn;
private static languageDe;
/**
* Language to be used for the modal.
* Currently supported: en, de
*/
readonly language: i0.InputSignal<string | undefined>;
/**
* Translation to be used for the modal.
* If specified, the language is ignored.
*/
readonly translation: i0.InputSignal<LoggingViewerTranslation | undefined>;
/**
* Comma-separated list of localStorageKeys. If set, the logs get loaded from localStorage instead of memory.
*/
readonly localStorageKeys: i0.InputSignal<string | undefined>;
/**
* Flag showing a delete button, which removes all existing log messages.
*/
readonly allowClearLogs: i0.InputSignal<boolean>;
/**
* Flag controlling which close button will be shown.
*/
isAndroid: boolean;
private logger;
private translations;
/**
* Creates a new instance of the component.
*/
constructor();
/**
* Initializes the LoggingViewerModalComponent.
* It configures the supported translations.
*/
ngOnInit(): void;
/**
* Eventhandler called by Ionic when the modal is opened.
*/
ionViewDidEnter(): void;
/**
* Eventhandler called when the cancel button is clicked.
*/
onClose(): Promise<void>;
/**
* Eventhandler called when the clear button is clicked.
*/
onClearLogs(): Promise<void>;
/**
* Clear logs.
*/
clearLogs(): void;
/**
* Helper method returning the current translation:
* - the property translation if defined
* - the translation according property language if valid
* - English translation, otherwise
*/
getTranslation(): LoggingViewerTranslation;
static ɵfac: i0.ɵɵFactoryDeclaration<LoggingViewerModalComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LoggingViewerModalComponent, "ionic-logging-viewer-modal", never, { "language": { "alias": "language"; "required": false; "isSignal": true; }; "translation": { "alias": "translation"; "required": false; "isSignal": true; }; "localStorageKeys": { "alias": "localStorageKeys"; "required": false; "isSignal": true; }; "allowClearLogs": { "alias": "allowClearLogs"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
}
/**
* Describes all properties which can be passed to the
* [LoggingViewerModalComponent](../classes/LoggingViewerModalComponent.html).
*/
interface LoggingViewerModalProperties {
/**
* Language to be used for the modal.
* Currently supported: en, de
*/
language?: string;
/**
* Translation to be used for the modal.
* If specified, the language is ignored.
*/
translation?: LoggingViewerTranslation;
/**
* Comma-separated list of localStorageKeys. If set, the logs get loaded from localStorage instead of memory.
*/
localStorageKeys?: string;
/**
* Flag showing a delete button, which removes all existing log messages.
*/
allowClearLogs?: boolean;
}
export { LoggingViewerComponent, LoggingViewerLevelsComponent, LoggingViewerModalComponent, LoggingViewerSearchComponent };
export type { LoggingViewerModalProperties, LoggingViewerTranslation };