@civic/nexus-bridge
Version:
Stdio <-> HTTP/SSE MCP bridge with Civic auth handling
108 lines • 2.74 kB
TypeScript
/**
* logger.ts
*
* Provides centralized logging functionality with support for different log levels,
* sensitive data masking, and configurable output formats.
*/
export declare enum LogLevel {
ERROR = 0,
WARN = 1,
INFO = 2,
DEBUG = 3,
TRACE = 4
}
interface LoggerOptions {
name?: string;
level?: LogLevel;
enableJsonFormatting?: boolean;
maskSensitiveData?: boolean;
includeTimestamps?: boolean;
}
/**
* Central logger class for the nexus bridge
* Provides consistent log formatting and control over verbosity
*/
export declare class Logger {
private level;
private enableJsonFormatting;
private maskSensitiveData;
private includeTimestamps;
private name;
private static readonly SENSITIVE_PATTERNS;
constructor(options?: LoggerOptions);
/**
* Set the log level
*/
setLevel(level: LogLevel): void;
/**
* Get the current log level
*/
getLevel(): LogLevel;
/**
* Get log level as a string
*/
getLevelName(): string;
/**
* Enable or disable JSON formatting for objects
*/
setJsonFormatting(enable: boolean): void;
/**
* Enable or disable sensitive data masking
*/
setMaskSensitiveData(mask: boolean): void;
/**
* Enable or disable timestamps in log output
*/
setIncludeTimestamps(include: boolean): void;
/**
* Format message and args for logging
*/
private format;
/**
* Safe clone and mask an object, handling circular references
*/
private safeCloneAndMask;
/**
* Create a replacer function for JSON.stringify that handles circular references
*/
private circularReplacer;
/**
* Check if a string value looks like a sensitive token
*/
private looksLikeSensitiveValue;
/**
* Check and mask a string if it appears to contain sensitive data
*/
private maskSensitiveString;
/**
* Mask a token to show only prefix
*/
private maskToken;
/**
* Write directly to stderr to avoid console redirection issues
*/
private writeToStderr;
/**
* Log error message
*/
error(message: string, ...args: any[]): void;
/**
* Log warning message
*/
warn(message: string, ...args: any[]): void;
/**
* Log info message
*/
info(message: string, ...args: any[]): void;
/**
* Log debug message - only shown when level is DEBUG or higher
*/
debug(message: string, ...args: any[]): void;
/**
* Log trace message - most verbose level
*/
trace(message: string, ...args: any[]): void;
}
export declare const logger: Logger;
export {};
//# sourceMappingURL=logger.d.ts.map