Skip to content

Logging and diagnostics

The Client SDK provides configurable logging to help with integration, debugging, and production monitoring. Log output covers internal HTTP traffic, API calls, WebRTC events, and session lifecycle.

Log levels

Set the logging level when creating the client. Available levels, from most to least verbose:

LevelUse case
VerboseFull trace output — useful during initial integration
DebugDetailed diagnostic information
InfoGeneral operational messages
WarnPotential issues that don't prevent operation
ErrorFailures only
NoneLogging disabled

Configuration

You can set a log level directly, disable the internal logger entirely, or provide custom logger implementations that route SDK output to your own logging infrastructure.

 val config = VGClientInitConfig(LoggingLevel.Verbose)
 val clientA = VonageClient(ctx, config)
 // or
 val clientB = VonageClient(
     ctx,
     VGClientInitConfig().apply {
         loggingLevel = LoggingLevel.Error
     }
 )
 // or setup custom loggers
 val clientC = VonageClient(
     ctx,
     VGClientInitConfig(
         disableInternalLogger = true,
         customLoggers = listOf(
             object : VonageLogger {
                 override val name: String = "CustomLoggerOne"
                 override val minLogLevel: LoggingLevel = LoggingLevel.Debug
                 override val topics: List<Topic> = listOf(Topic.HTTP, Topic.API).flatten()
                 override fun onLog(logLevel: LoggingLevel, topic: Topic, message: String, throwable: Throwable?) {
                     println("$logLevel ${topic.name} ${topic.tag} $message")
                 }
             },
             createVonageLogger("CustomLoggerTwo"){ logLevel, topic, message, _ ->
                 println("$logLevel ${topic.name} ${topic.tag} $message")
             }
         )
     )
 )

Custom loggers

Custom loggers receive structured log events with:

  • level — the severity of the log entry
  • topic — categorizes the log source (e.g. HTTP, API, WebRTC)
  • message — the log content

Use custom loggers to integrate SDK diagnostics with your existing logging or crash reporting tools (e.g. Sentry, Datadog, Crashlytics).

Topic filtering

Each logger can subscribe to specific topics to reduce noise. Available topic groups include HTTP, API, and others. Filtering by topic is useful in production where you may only want to capture network-level events without verbose internal state logging.

Recommendations

  • Use Verbose during development and initial integration to understand call flow and event ordering.
  • Use Error or Warn in production builds to minimize performance overhead.
  • If you need production diagnostics without full verbosity, use a custom logger filtered to specific topics.

Built with VitePress.