LoggingService Service
File: src/services/LoggingService.ts
Overview
Exports
- LogLevel - type export
- LogCategory - type export
- LogEntry - interface export
- LoggingConfig - interface export
- loggingService - const export
- log - const export
Classes
LoggingService
No description available.
Methods:
constructorloadConfigupdateConfigsetUserConsenthasUserConsentgetOrCreateSessionIdshouldLogsanitizeDatacreateEntryaddToBufferdebuginfowarnerrorlogNavigationlogInteractionlogPerformancelogNetworkErrorlogAuthEventlogFederationEventlogVoiceEventsaveBufferToStorageloadBufferFromStorageclearBufferstartFlushTimerflushToServercatchsetupGlobalErrorHandlerssetupPerformanceObserversgetBufferexportLogsdownloadLogsdestroy
Properties:
configbufferflushTimersessionIderrorCountMAX_ERRORS_PER_SESSIONConfigurationstorederrorsconsentIgnoreuserConsentManagementMethodsfalsesanitizedpatternscontinueobjectsvaluedatalevelcategorymessageerrorentryidtimestampurlwidthheightdetailsnamestacklargestorageLoggingtoelementdurationstatuspathsuccesseventdomainissuesrecentEntriesentriesloggingentriesToSendserverfilteredendpointbodyHandlersfilenamelinenocolnorejectionsoriginalErrorObserversPerformanceObserverlongTaskObserver100msstartTimeentryTypesclsObservershifthadRecentInputlcpObserverlastEntryobserverstimingpageLoadTimedomContentLoadedttfbblobaCleanup
Interfaces
LogEntry
No description available.
typescript
interface LogEntry {
id: string
timestamp: string
level: LogLevel
category: LogCategory
message: string
data?: Record<string, any>
context?: {
url?: string
route?: string
userId?: string // Hashed if consent not given
sessionId?: string
userAgent?: string
viewport?: { width: number; height: number }
}
performance?: {
duration?: number
memoryUsage?: number
timestamp?: number
}
error?: {
name?: string
message?: string
stack?: string
componentSt
// ...
}LoggingConfig
No description available.
typescript
interface LoggingConfig {
enabled: boolean
minLevel: LogLevel
sendToServer: boolean
bufferSize: number
flushInterval: number // ms
userConsent: boolean // Privacy consent for detailed logging
includePerformance: boolean
includeNavigation: boolean
includeInteractions: boolean
excludePatterns: RegExp[] // Patterns to exclude from logging
}Type Definitions
LogLevel
No description available.
typescript
export type LogLevel = 'debug' | 'info' | 'warn' | 'error'
export type LogCategory =
| 'error'
| 'performance'
| 'navigation'
| 'interaction'
| 'network'
| 'auth'
| 'federation'
| 'voice'
| 'custom'
export interface LogEntry {
id: string
timestamp: string
level: LogLevel
category: LogCategory
message: string
data?: Record<string, any>
context?: {
url?: string
route?: string
userId?: string // Hashed if consent not given
sessionId?: string
us...Constants
LOG_LEVELS
No description available.
typescript
const LOG_LEVELS: Record<LogLevel, number> = {DEFAULT_CONFIG
No description available.
typescript
const DEFAULT_CONFIG: LoggingConfig = {STORAGE_KEY
No description available.
typescript
const STORAGE_KEY = 'harmony_log_buffer'CONSENT_KEY
No description available.
typescript
const CONSENT_KEY = 'harmony_logging_consent'SESSION_ID_KEY
No description available.
typescript
const SESSION_ID_KEY = 'harmony_session_id'Source Code Insights
File Size: 18168 characters Lines of Code: 641 Imports: 2
Usage Example
typescript
import { LogLevel, LogCategory, LogEntry, LoggingConfig, loggingService, log } from '@/services/LoggingService'
// Example usage
// Use the exported functionalityThis documentation was automatically generated from the source code.
