val client = ChatClient.Builder("apiKey", context)
.logLevel(ChatLogLevel.ALL)
.build()This is documentation for Stream Chat Android SDK v6, which is no longer actively maintained. For up-to-date documentation, see the latest version (v7).
Logging
SDK logs are disabled by default. You can enable logs and set a log level when initializing ChatClient.
You can set logs at the following levels:
ChatLogLevel.ALLto see all log entries.ChatLogLevel.DEBUGto see debug, warning, and error entries.ChatLogLevel.WARNto see warning and error entries.ChatLogLevel.ERRORto see error entries.ChatLogLevel.NOTHINGto not show any logs.
You should only enable logging in development builds.
Intercepting Logs
To intercept logs from the SDK, you can also pass in your own ChatLoggerHandler:
val client = ChatClient.Builder("apiKey", context)
.logLevel(ChatLogLevel.ALL)
.loggerHandler(object : ChatLoggerHandler {
override fun logT(throwable: Throwable) {
// custom logging
}
override fun logT(tag: Any, throwable: Throwable) {
// custom logging
}
override fun logI(tag: Any, message: String) {
// custom logging
}
override fun logD(tag: Any, message: String) {
// custom logging
}
override fun logV(tag: Any, message: String) {
// custom logging
}
override fun logW(tag: Any, message: String) {
// custom logging
}
override fun logE(tag: Any, message: String) {
// custom logging
}
override fun logE(tag: Any, message: String, throwable: Throwable) {
// custom logging
}
})
.build()Filtering Logs
All SDK log tags have Chat: as a prefix that you can use when filtering logs.
adb logcat com.your.package | grep "Chat:"Here's a set of useful tags for debugging network communication:
Chat:Httpto see HTTP requests made from theChatClientand the responses returned by Stream.Chat:Eventsto see a list of events that theChatClientemits.Chat:Socketto see socket-related events.