UNPKG

magically-sdk

Version:

Official SDK for Magically - Build mobile apps with AI

78 lines (77 loc) 1.87 kB
/** * Simple, formatted logger for Magically SDK * Provides clean, readable debug output */ export declare class Logger { private isDebugEnabled; private prefix; private requestCounter; constructor(isDebugEnabled?: boolean, prefix?: string); /** * Log debug information (only when debug is enabled) */ debug(step: string, data?: any): void; /** * Log success steps */ success(step: string, data?: any): void; /** * Log errors (always shown, regardless of debug flag) */ error(step: string, error?: any): void; /** * Log warnings */ warn(step: string, data?: any): void; /** * Log info (always shown) */ info(step: string, data?: any): void; /** * Sanitize sensitive data for logging */ private sanitizeData; /** * Create a scoped logger for a specific component */ scope(scopeName: string): Logger; /** * Generate unique request ID */ private generateRequestId; /** * Sanitize URLs for logging */ private sanitizeUrl; /** * Sanitize headers for logging */ private sanitizeHeaders; /** * Log network request */ networkRequest(method: string, url: string, options?: { headers?: Record<string, string>; body?: any; requestId?: string; operation?: string; }): string; /** * Log network response */ networkResponse(requestId: string, response: { status: number; statusText?: string; duration?: number; data?: any; headers?: Record<string, string>; operation?: string; }): void; /** * Log network error */ networkError(requestId: string, error: any, options?: { duration?: number; operation?: string; }): void; }