/** * QwickApps CMS Logging * * Provides centralized logging for the CMS package with optional remote log forwarding. * Dependencies @qwickapps/logging and @qwickapps/log-client are optional. * * What to log: * - Authentication failures * - Collection operation errors * - Plugin initialization errors * - Configuration warnings * - Database connection issues * - Unexpected exceptions * * What NOT to log (already captured by web analytics/access logs): * - Normal page requests * - Successful API calls * - User sessions * - Page views * * Environment Variables: * LOG_SERVICE_URL - Log server URL (e.g., https://logs.qwickapps.com) * LOG_SERVICE_TOKEN - Service account token for authentication * LOG_ENABLED - Enable/disable remote logging (default: true in production) * * @module @qwickapps/cms/logging */ type LogLevel = 'debug' | 'info' | 'warn' | 'error'; interface LoggerInterface { debug(message: string, context?: Record): void; info(message: string, context?: Record): void; warn(message: string, context?: Record): void; error(message: string, context?: Record): void; setConfig?(config: Record): void; } /** * Create a CMS logger with optional remote log forwarding * * @param namespace - Logger namespace (e.g., 'Auth', 'Collections', 'Plugins') * @returns Configured Logger instance * * @example * const log = createCMSLogger('Auth'); * log.error('Authentication failed', { userId, reason: 'invalid_token' }); */ export declare function createCMSLogger(namespace: string): LoggerInterface; /** * Pre-configured loggers for common CMS operations */ export declare const cmsLoggers: { /** Authentication events (login failures, token issues) */ auth: LoggerInterface; /** Collection operations (CRUD errors, validation failures) */ collections: LoggerInterface; /** Plugin lifecycle (initialization errors, configuration issues) */ plugins: LoggerInterface; /** Database operations (connection errors, query failures) */ database: LoggerInterface; /** API errors (endpoint failures, response errors) */ api: LoggerInterface; /** Configuration issues (missing env vars, invalid settings) */ config: LoggerInterface; }; /** * Flush all pending logs (call before process exit) */ export declare function flushCMSLogs(): Promise; /** * Get log client statistics (for health checks) */ export declare function getLogStats(): Record | null; export type { LogLevel, LoggerInterface as Logger }; //# sourceMappingURL=index.d.ts.map