Skip to main content
Version: v6

Stream Logger

StreamLog was originally a part of stream-chat-android, but it has been extracted into an open-source library that you can use in your own project without the need to depend on ChatSDK.

In case you have used StreamLog in your project previously, you can now use the open-source library instead.


You can add the dependency to your project by using the following code:

dependencies {
implementation "io.getstream:stream-log:$stream_log_version"

StreamLog itself represents a logging manager (entry point) that allows you to install a logger and configure the output.

// Install a logger
StreamLog.installLogger(logger = KotlinLogger())

// Configure the output.
// The log will be printed to the console only if the priority is DEBUG and the tag is TAG_NAME
StreamLog.setValidator { priority, tag ->
priority.level >= Priority.DEBUG.level && tag == "TAG_NAME"

Now you can use the logger to print the log:

streamLog(priority = Priority.INFO, tag = "TAG_NAME") { "This is a log message 1" }
StreamLog.d(tag = "TAG_NAME") { "This is a log message 2" }

That will result in the following output:

2023-06-21 16:43:50'345 (main:1) [I/TAG_NAME]: This is a log message 1
2023-06-21 16:43:50'345 (main:1) [D/TAG_NAME]: This is a log message 2

Additionally, you can use the tagged logger per class usage, like in example below:

class SomeClass {
private val logger = StreamLog.getLogger(tag = "SomeClass")
// OR you can use the lazy initialization
private val logger by taggedLogger(tag = "SomeClass")

fun someFunction() {
logger.d { "This is a log message" }

If you don't specify the tag for taggedLogger, the class name will be used as a tag.

Android Logging

If you have used other implementations of StreamLogger such as AndroidStreamLogger. It has be extracted to the separate library as well.

Here is the way it can be included into your project:

dependencies {
implementation "io.getstream:stream-log-android:$stream_log_version"


AndroidStreamLogger is a logger implementation which utilizes Logcat for the logs printing. It can be installed as shown in the snippet below.

class App : Application() {

override fun onCreate() {

// install AndroidStreamLogger.

// change the log validator as your taste.
StreamLog.setValidator { priority, tag ->
priority.level >= Priority.VERBOSE.level && tag == "TAG_NAME"

Did you find this page helpful?