@fjell/logging
Version:
Logging for Fjell
39 lines (38 loc) • 1.31 kB
TypeScript
/**
* Masking middleware for logging pipeline
* Applies sensitive data masking to log entries before they reach writers/transports
*/
import { MaskingConfig } from "../utils/maskSensitive";
/**
* Log entry structure that gets processed by the middleware
*/
export interface LogEntry {
level: string;
message: string;
timestamp: string;
data?: any;
meta?: any;
/** Optional correlation ID for request tracing */
correlationId?: string;
[key: string]: any;
}
/**
* Masking middleware function
* @param entry - The log entry to process
* @param config - Masking configuration
* @returns The masked log entry
*/
export declare function maskLogEntry(entry: LogEntry, config?: MaskingConfig): LogEntry;
/**
* Creates a masking middleware function with the given configuration
* @param config - Masking configuration
* @returns A middleware function that can be used in the logging pipeline
*/
export declare function createMaskingMiddleware(config?: MaskingConfig): (entry: LogEntry) => LogEntry;
/**
* Batch masking for multiple log entries
* @param entries - Array of log entries to mask
* @param config - Masking configuration
* @returns Array of masked log entries
*/
export declare function maskLogEntries(entries: LogEntry[], config?: MaskingConfig): LogEntry[];