UNPKG

plogger-sdk

Version:

Typescript based frontend logging library compatible with multiple transports and JS/TS frameworks

38 lines (37 loc) 1.44 kB
import { BaseLogger } from "../Logger"; import { logLevelType } from "../logLevel"; import { httpConfig, batchOptions, retryOptions } from "./http-config"; import { httpLog } from "./http-log"; import { logRecord } from "../logs/log-record"; /** * HttpLogger -> defines the logger to infer logs to the remote server */ export declare class HttpLogger extends BaseLogger { /**define the timeout object to flush the last log batch*/ private timeoutRef; /**takes the url of the remote server */ serverUrl: string; /**define the batch options */ batchOptions: batchOptions; /**define the retry options */ retryOptions: retryOptions; /**define the level threshold on which the logs can be directly sent to the server rather than a batch */ highPriority: logLevelType; private headers; /**sets cookies and other auth tokens to the request headers */ private setCredentials; showFormattedLog: boolean; logBucket: httpLog[]; config: httpConfig; constructor({ serverUrl, batchOptions, retryOptions, highPriority, setCredentials, showFormattedLog, }: httpConfig); private _buildLogObject; setPriorityLog(priority_level: logLevelType): void; /** * Set custom headers to your Http Request * @param headers Headers() */ setHeaders(headers: Object): void; log(logRecord: logRecord): void; private sendBatchRequest; private sendRequest; }