omnis-logger-sdk
Version:
Lightweight TypeScript SDK for error tracking and application monitoring in React Native and Web applications
89 lines • 3.67 kB
TypeScript
interface LoggerConfig {
apiKey: string;
apiUrl?: string;
environment?: 'development' | 'staging' | 'production';
platform?: string;
version?: string;
userId?: string;
sessionId?: string;
enabled?: boolean;
sensitiveKeys?: string[];
deviceInfo?: any;
maxBreadcrumbs?: number;
}
interface Breadcrumb {
timestamp: number;
category: 'navigation' | 'user-action' | 'network' | 'state-change' | 'ui' | 'error' | 'console';
message: string;
level?: 'info' | 'warning' | 'error';
data?: any;
}
interface AppContext {
component?: string;
screen?: string;
route?: string;
function?: string;
[key: string]: any;
}
export declare function init(userConfig: LoggerConfig): void;
declare function clearBreadcrumbs(): void;
export declare function log(level: 'error' | 'warn' | 'info' | 'debug', message: string, context?: any): void;
export declare function setUserId(userId: string, syncWithServer?: boolean): void;
export declare function updateSession(updates: {
userId?: string;
sessionId?: string;
}): Promise<void>;
export declare function setContext(context: {
userId?: string;
sessionId?: string;
}): void;
export declare function setEnabled(enabled: boolean): void;
export declare function getConfig(): Partial<LoggerConfig>;
export declare function setAppContext(context: Partial<AppContext>, skipBreadcrumb?: boolean): void;
export declare function getAppContext(): AppContext;
export declare function clearAppContext(): void;
export declare function leaveBreadcrumb(category: Breadcrumb['category'], message: string, data?: any): void;
export declare function trackNavigation(route: string, params?: any): void;
export declare function trackUserAction(action: string, data?: any): void;
export declare function trackStateChange(description: string, data?: any): void;
export declare function trackUIEvent(event: string, data?: any): void;
export declare function getBreadcrumbsDebug(): Breadcrumb[];
export declare function testBreadcrumbs(): void;
export declare function startFlow(flowName: string, flowId?: string): string;
export declare function logFlow(level: 'error' | 'warn' | 'info' | 'debug', message: string, context?: any): void;
export declare function endFlow(level?: 'error' | 'warn' | 'info' | 'debug', summaryMessage?: string): void;
export declare function getCurrentFlow(): {
flowId: string;
flowName: string;
eventsCount: number;
} | null;
export declare function useComponentTracking(componentName: string): void;
export declare function captureReactError(error: Error, errorInfo: any): void;
declare const _default: {
init: typeof init;
log: typeof log;
setUserId: typeof setUserId;
setContext: typeof setContext;
setEnabled: typeof setEnabled;
getConfig: typeof getConfig;
updateSession: typeof updateSession;
setAppContext: typeof setAppContext;
getAppContext: typeof getAppContext;
clearAppContext: typeof clearAppContext;
leaveBreadcrumb: typeof leaveBreadcrumb;
trackNavigation: typeof trackNavigation;
trackUserAction: typeof trackUserAction;
trackStateChange: typeof trackStateChange;
trackUIEvent: typeof trackUIEvent;
clearBreadcrumbs: typeof clearBreadcrumbs;
useComponentTracking: typeof useComponentTracking;
captureReactError: typeof captureReactError;
getBreadcrumbsDebug: typeof getBreadcrumbsDebug;
testBreadcrumbs: typeof testBreadcrumbs;
startFlow: typeof startFlow;
logFlow: typeof logFlow;
endFlow: typeof endFlow;
getCurrentFlow: typeof getCurrentFlow;
};
export default _default;
//# sourceMappingURL=index.d.ts.map