import { LogStreamConfig } from './core/types'; import { FunctionLogContext } from './core/function-tracing/context/context'; import { FunctionLogEntry } from './core/function-tracing/wrapper'; import { createFunctionLogMiddleware, RequestInfo, ResponseInfo } from './core/function-tracing/context/middleware'; import { SanitizerOptions } from './core/function-tracing/masking/sanitizer'; import { FunctionMaskingOverride } from './core/function-tracing/masking/rule-builder'; import { SourceLocation } from './core/utils/source-location'; export * from './core/types'; export type { FunctionLogContext, FunctionLogEntry, SanitizerOptions, FunctionMaskingOverride, RequestInfo, ResponseInfo, SourceLocation, }; /** * 함수 로깅 설정 */ export interface FunctionLoggingConfig { /** 함수 로깅 활성화 여부 */ enabled?: boolean; /** 포함할 경로 패턴 */ include?: RegExp[]; /** 제외할 경로 패턴 */ exclude?: RegExp[]; /** 제외할 함수 이름 패턴 */ excludeFunctions?: RegExp[]; /** 중첩 객체의 함수도 래핑할지 여부 */ wrapNestedObjects?: boolean; /** Sanitizer 옵션 */ sanitizerOptions?: SanitizerOptions; /** 파라미터 기반 자동 마스킹 활성화 (기본값: true) */ enableAutoMasking?: boolean; /** 추가 민감 키워드 (password, token 등 기본값 외 추가) */ sensitiveKeywords?: string[]; /** 함수별 마스킹 Override 설정 */ maskingOverrides?: FunctionMaskingOverride[]; /** getter/setter 래핑 여부 (기본값: true) */ wrapGettersSetters?: boolean; /** 함수 로그 콜백 */ onFunctionLog?: (entry: FunctionLogEntry) => void; /** 요청 시작 콜백 */ onRequest?: (info: RequestInfo) => void; /** 응답 완료 콜백 */ onResponse?: (info: ResponseInfo) => void; } /** * Network Logging 설정 */ export interface NetworkLoggingConfig { /** Inbound HTTP 로깅 활성화 여부 (기본: false) */ enableInboundHttpLogging?: boolean; } /** * Error Reporter 설정 */ export interface ErrorReporterConfig { /** 에러 리포팅 활성화 여부 (기본: true) */ enabled?: boolean; /** 디버그 모드 (콘솔에 에러 출력) */ debug?: boolean; } /** * 확장된 LogStream 설정 */ export interface ExtendedLogStreamConfig extends LogStreamConfig { /** 함수 로깅 설정 */ functionLogging?: FunctionLoggingConfig; /** 네트워크 로깅 설정 */ networkLogging?: NetworkLoggingConfig; /** SDK 내부 에러 리포팅 설정 */ errorReporting?: ErrorReporterConfig; } declare class LogStream { private client?; private consoleInterceptor?; private initialized; private contextManager?; private functionLoggingConfig?; private functionLogs; private networkLoggingConfig?; /** * Initialize LogStream SDK */ init(config: ExtendedLogStreamConfig): LogStream; /** * Initialize function logging */ private initFunctionLogging; /** * Create Winston transport */ winstonTransport(): any; /** * Create Pino stream */ pinoStream(): any; /** * Manually flush buffered logs */ flush(): void; /** * Destroy the SDK and restore original console methods */ destroy(): void; /** * Get Express/Connect compatible middleware for request context * This middleware creates a trace context for each HTTP request, * allowing all function logs within the request to share the same traceId. * * When `networkLogging.enableInboundHttpLogging` is true, it will also * capture inbound HTTP requests and responses. */ middleware(): ReturnType; /** * Get the current trace ID from the context */ getTraceId(): string | undefined; /** * Get the current context */ getContext(): FunctionLogContext | undefined; /** * Run a callback within a custom context */ runWithContext(context: FunctionLogContext, callback: () => T): T; /** * Get recent function logs */ getFunctionLogs(limit?: number): FunctionLogEntry[]; /** * Clear function logs buffer */ clearFunctionLogs(): void; /** * Check if function logging is active */ isFunctionLoggingActive(): boolean; /** * Check if SDK is initialized */ isInitialized(): boolean; /** * Get current stats and metrics */ getStats(): { logs: { bufferSize: number; isHealthy: boolean; failureCount: number; }; metrics: { bufferSize: number; isHealthy: boolean; failureCount: number; }; httpRequests: { bufferSize: number; isHealthy: boolean; failureCount: number; }; } | null; } declare const logStream: LogStream; export default logStream; export { LogStream };