@contiva/sap-integration-suite-client
Version:
SAP Cloud Platform Integration API Client
71 lines (70 loc) • 1.7 kB
TypeScript
/**
* Structured logging utility for cache operations
*
* Provides structured logging with log levels (INFO, DEBUG, WARN, ERROR)
* and support for metrics (counts, durations, etc.)
*
* @module cache-logger
*/
/**
* Log levels
*/
export declare enum LogLevel {
DEBUG = 0,
INFO = 1,
WARN = 2,
ERROR = 3
}
/**
* Log entry structure
*/
export interface LogEntry {
level: LogLevel;
message: string;
context?: string;
metrics?: Record<string, number | string | boolean>;
error?: Error;
timestamp: number;
}
/**
* Structured logger for cache operations
*/
declare class CacheLogger {
private config;
private readonly debugMode;
constructor();
/**
* Logs a message with the specified level
*/
private log;
/**
* Logs to console in a human-readable format (backward compatible)
*/
private logToConsole;
/**
* Logs structured output (JSON format)
*/
private logStructured;
/**
* Determines if structured logging should be used for this level
*/
private shouldLogStructured;
/**
* Logs a DEBUG message
*/
debug(message: string, context?: string, metrics?: Record<string, any>): void;
/**
* Logs an INFO message with optional metrics
*/
info(message: string, context?: string, metrics?: Record<string, any>): void;
/**
* Logs a WARN message
*/
warn(message: string, context?: string, metrics?: Record<string, any>): void;
/**
* Logs an ERROR message
*/
error(message: string, context?: string, metrics?: Record<string, any>, error?: Error): void;
}
export declare const cacheLogger: CacheLogger;
export {};