ionic-logging-service
Version:
Logging functionalities for apps built with Ionic framework
93 lines (92 loc) • 2.72 kB
TypeScript
import { EventEmitter } from "@angular/core";
import * as log4javascript from "log4javascript";
import { AjaxAppenderConfiguration } from "./ajax-appender.configuration";
/**
* An appender which sends the log messages to a server via HTTP.
*
* A typical configuration could be:
*
* ```json
* {
* "url": "https://my.backend.xy/LoggingBackend",
* "batchSize": 10,
* "timerInterval": 60000,
* "threshold": "INFO"
* }
* ```
*/
export declare class AjaxAppender extends log4javascript.Appender {
private static batchSizeDefault;
private static timerIntervalDefault;
private static thresholdDefault;
/**
* Event triggered when the appender could not send log messages to the server.
*
* @param message error message
*/
appenderFailed: EventEmitter<string>;
private ajaxAppender;
private url;
private withCredentials;
/**
* Creates a new instance of the appender.
*
* @param configuration configuration for the appender.
*/
constructor(configuration: AjaxAppenderConfiguration);
/**
* Configures the logging depending on the given configuration.
*
* Only the defined properties get overwritten.
* Neither url nor withCredentials can be modified.
*
* @param configuration configuration data.
*/
configure(configuration: AjaxAppenderConfiguration): void;
/**
* Appender-specific method to append a log message.
*
* @param loggingEvent event to be appended.
*/
append(loggingEvent: log4javascript.LoggingEvent): void;
/**
* Gets the appender's name.
* Mainly for unit testing purposes.
*
* @return appender's name
*/
toString(): string;
/**
* Get the internally used appender.
* Mainly for unit testing purposes.
*/
getInternalAppender(): log4javascript.AjaxAppender;
/**
* Returns the number of log messages sent in each request.
*/
getBatchSize(): number;
/**
* Sets the number of log messages to send in each request.
*
* @param batchSize new batch size
*/
setBatchSize(batchSize: number): void;
/**
* Returns the appender's layout.
*/
getLayout(): log4javascript.Layout;
/**
* Sets the appender's layout.
*/
setLayout(layout: log4javascript.Layout): void;
/**
* Returns the length of time in milliseconds between each sending of queued log messages.
*/
getTimerInterval(): number;
/**
* Sets the length of time in milliseconds between each sending of queued log messages.
*
* @param timerInterval new timer interval
*/
setTimerInterval(timerInterval: number): void;
}