ngx-logger
Version:
[](https://www.npmjs.com/package/ngx-logger)
77 lines • 3.44 kB
TypeScript
import { HttpBackend, HttpHeaders, HttpParams, HttpRequest } from '@angular/common/http';
import { NgZone, OnDestroy } from '@angular/core';
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
import { INGXLoggerConfig } from '../config/iconfig';
import { INGXLoggerMetadata } from '../metadata/imetadata';
import { INGXLoggerServerService } from './iserver.service';
import * as i0 from "@angular/core";
export declare class NGXLoggerServerService implements INGXLoggerServerService, OnDestroy {
protected readonly httpBackend: HttpBackend;
protected readonly ngZone: NgZone;
protected serverCallsQueue: INGXLoggerMetadata[];
protected flushingQueue: BehaviorSubject<boolean>;
protected addToQueueTimer: Subscription;
constructor(httpBackend: HttpBackend, ngZone: NgZone);
ngOnDestroy(): void;
/**
* Transforms an error object into a readable string (taking only the stack)
* This is needed because JSON.stringify would return "{}"
* @param err the error object
* @returns The stack of the error
*/
protected secureErrorObject(err: Error): string;
/**
* Transforms the additional parameters to avoid any json error when sending the data to the server
* Basically it just replaces unstringifiable object to a string mentioning an error
* @param additional The additional data to be sent
* @returns The additional data secured
*/
protected secureAdditionalParameters(additional: any[]): any[];
/**
* Transforms the message so that it can be sent to the server
* @param message the message to be sent
* @returns the message secured
*/
protected secureMessage(message: any): string;
/**
* Edits HttpRequest object before sending request to server
* @param httpRequest default request object
* @returns altered httprequest
*/
protected alterHttpRequest(httpRequest: HttpRequest<any>): HttpRequest<any> | Observable<HttpRequest<any>>;
/**
* Sends request to server
* @param url
* @param logContent
* @param options
* @returns
*/
protected logOnServer(url: string, logContent: any, options: {
headers?: HttpHeaders;
reportProgress?: boolean;
params?: HttpParams;
responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';
withCredentials?: boolean;
}): Observable<any>;
/**
* Customise the data sent to the API
* @param metadata the data provided by NGXLogger
* @returns the data that will be sent to the API in the body
*/
protected customiseRequestBody(metadata: INGXLoggerMetadata | INGXLoggerMetadata[]): any;
/**
* Flush the queue of the logger
* @param config
*/
flushQueue(config: INGXLoggerConfig): void;
protected sendToServerAction(metadata: INGXLoggerMetadata | INGXLoggerMetadata[], config: INGXLoggerConfig): void;
/**
* Sends the content to be logged to the server according to the config
* @param metadata
* @param config
*/
sendToServer(metadata: INGXLoggerMetadata, config: INGXLoggerConfig): void;
static ɵfac: i0.ɵɵFactoryDeclaration<NGXLoggerServerService, [{ optional: true; }, { optional: true; }]>;
static ɵprov: i0.ɵɵInjectableDeclaration<NGXLoggerServerService>;
}
//# sourceMappingURL=server.service.d.ts.map