/** * Representation of a log level capable of comparison. * @export * @enum {number} Numeric representation of a log level. */ export declare enum LogLevel { trace = 0, debug = 1, info = 2, warn = 3, error = 4, fatal = 5, } /** * Given a log level represented as a string or LogLevel, return the * corresponding LogLevel representation. * @export * @param {(LogLevel | String)} level String corresponding to a log level or a LogLevel object. * @returns {LogLevel} Specified LogLevel. */ export declare function logNameToLogLevel(level: LogLevel | String): LogLevel; /** * Enumerates and restricts the possible module types. */ declare const PuiModuleType: { view: "View"; provider: "Provider"; service: "Service"; other: "Other"; }; declare type PuiModuleType = (typeof PuiModuleType)[keyof typeof PuiModuleType]; export { PuiModuleType }; /** * The portion of an application which resulted in a log entry in order to provide context * for the log entry. * @export * @interface PuiLogContext */ export interface PuiLogContext { logContext: { appName: string; appModuleName: string; appModuleType: PuiModuleType; }; } /** * Custom metadata associated with a log entry shall be represented * as key value pairs using this interface. Required to support calling * the required key and value within logger implementations. * @export * @interface LogMetadata */ export interface LogMetadata { name: string; value: string; } /** * A data item for diagnostic logging. * @export * @interface PuiDiagnosticLogData */ export interface PuiDiagnosticLogData { level?: LogLevel; message: string; details?: string; error?: Error; context?: PuiLogContext; meta?: LogMetadata[]; } /** * Determine whether the provided PuiDiagnosticLogData is valid. * @export * @param {PuiDiagnosticLogData} toTest Item to test. * @returns {boolean} true if valid, false otherwise. */ export declare function isValidDiagnosticLogData(toTest: PuiDiagnosticLogData): boolean; /** * A set of data for event logging. * @export * @interface PuiEventLogData */ export interface PuiEventLogData { name: string; context?: PuiLogContext; type?: string; meta?: LogMetadata[]; } /** * Determine whether the provided PuiEventLogData is valid. * @export * @param {PuiEventLogData} toTest Item to test. * @returns {boolean} true if valid, false otherwise. */ export declare function isValidEventLogData(toTest: PuiEventLogData): boolean; /** * A set of data for performance logging. * @export * @interface PuiPerformanceLogData */ export interface PuiPerformanceLogData { name: string; context?: PuiLogContext; start?: Date; end?: Date; elapsedTime?: number; elapsedUnits?: string; meta?: LogMetadata[]; } /** * Determine whether the provided PuiPerformanceLogData is valid. * @export * @param {PuiPerformanceLogData} toTest Item to test. * @returns {boolean} true if valid, false otherwise. */ export declare function isValidPerformanceLogData(toTest: PuiPerformanceLogData): boolean; /** * Produce a date string appropriate for logging. * @export * @param {Date} d Date to format. * @returns {string} String representation of the input date. */ export declare function formatDate(d: Date): string; /** * Produce a PuiDiagnosticLogData object. * @export * @param {LogLevel} logLevel Log level (severity) of the item. * @param {string} message Primary log message. * @param {string} [details] Additional message details. (optional) * @param {Error} [error] Error object to include. (optional) * @param {PuiLogContext} [context] Description of what generated the item to log. (optional) * @param {LogMetadata[]} [meta] Arbitrary key-value pairs of additional metadata to include. (optional) * @returns {PuiDiagnosticLogData} Resyktubg data object. */ export declare function buildDiagnosticData(logLevel: LogLevel, message: string, details?: string, error?: Error, context?: PuiLogContext, meta?: LogMetadata[]): PuiDiagnosticLogData; /** * Produce an PuiEventLogData object. * @export * @param {string} name Name of the event. The primary message. * @param {PuiLogContext} [context] Description of what generated the item to log. (optional) * @param {string} [thisType] Type of the event. (optional) * @param {LogMetadata[]} [meta] Arbitrary key-value pairs of additional metadata to include. (optional) * @returns {PuiEventLogData} Resulting data object. */ export declare function buildEventData(name: string, context?: PuiLogContext, thisType?: string, meta?: LogMetadata[]): PuiEventLogData; /** * Produce a PuiPerformanceLogData object. * @export * @param {string} name Name of the performance measure. The primary message. * @param {PuiLogContext} [context] Description of what generated the item to log. (optional) * @param {Date} [start] Start timestamp of the operation, if any. (optional) * @param {Date} [end] End timestamp of the operation, if any. (optional) * @param {number} [elapsedTime] A provided elapsed time. (optional) * @param {string} [elapsedUnits] Units corresponding to the elapsedTime parameter. (optional) * @param {LogMetadata[]} [meta] Arbitrary key-value pairs of additional metadata to include. (optional) * @returns {PuiPerformanceLogData} Resulting data object. */ export declare function buildPerformanceData(name: string, context?: PuiLogContext, start?: Date, end?: Date, elapsedTime?: number, elapsedUnits?: string, meta?: LogMetadata[]): PuiPerformanceLogData;