import { Subject } from 'rxjs'; import { IConnectionActivity } from './communicator'; import { IStatusChange } from './sentinel/status'; /** * A service call result event. These will be logged by fetchData(...) calls * * @export * @interface IServiceActivity */ export interface IServiceActivity { start_ts: number; end_ts: number; request: { url: string; headers: { [key: string]: string; }; data: any; }; status: number; response?: Response; } /** * A generic application event to add to the log. * Could be wired to route changes or certain components activating or sharing * some result * * @export * @interface IApplicationActivity */ export interface IApplicationActivity { url: string; component: string; description?: string; status: 'ok' | 'activate' | 'deactivate' | 'error' | 'warning'; data?: any; } /** * An event log entry. Could be one of various types: * * - service call * - communicator (signalr) activity * - application * * @export * @interface EventLog */ export interface EventLog { event_type: 'service' | 'communicator' | 'sentinel-status' | 'application'; data: IServiceActivity | IConnectionActivity | IStatusChange | IApplicationActivity; } /** * This collector and emitter can help applications with creating a local log * of actions happening in the SDK. It could also prove valuable for analytics. * The NetworkHealthMonitor uses these events for monitoring purposes * * @export * @class EventLogger */ export declare class EventLogger { /** * The activity log stream * * @type {Subject} */ changes$: Subject; /** * This method will emit a service activity event. * Will be called by core.fetch but is exposed for other fetch sources * * @param {IServiceActivity} event */ addServiceEvent(event: IServiceActivity): void; /** * This method will emit an application activity event. * Can be used by the application using the SDK to log an event * * @param {IApplicationActivity} event */ addApplicationEvent(event: IApplicationActivity): void; constructor(); } export declare const eventLogger: EventLogger;