Hmm double check here as I am not sure, when I am ...
# multiplatform
j
Hmm double check here as I am not sure, when I am using print or println, do I need something extra in multiplatform project for Android and IOS to see it, or some special debugging? I dont really care at moment how its printed, just want to see it somewhere. Or do I need to introduce framework for this?
p
Android prints to stdout, iOS iirc to the console
j
Do you know where I find these? Cant see in logcat in Android Studio in my case.
p
empty the filter so you can see all messages
j
Yeah I did, nothing displays.
Copy code
private fun saveAnswers() {
        coroutineScope.launch {
            val result = firebaseStore.collection("/Test").get().documents.first()
            print("Document" + result)
        }
    }
Nothing comes from this 🙂
p
add a println(“Hello unicorns”) in the body of saveAnswers ^^ Maybe your suspend function is hanging
j
What, if I change from print to println it works 😄
p
🤷
j
Ah well, I blame logcat or stdout not working as should 😄 Thanks for help!
p
🦆 🦆
j
Btw if I want to add Android logcat metadata like Tags, is that possible?
Or does that collide with like iOS prints and such?
p
Probably depends on what you want to do. You can use a library or create an expect fun that uses android.util.Log on Droid and println on ios
p
Xcode console also an alternative.
j
Right, make sense. Need to create my own logger as I always do in all my projects 😄 Usually need to delegate things in JNI stuff or other complex things and need to pipe things backwards depending on platform impl 😛
I guess it exists some crossplatform logging frameworks for this already?
Interesting it can also integrate into crashlytics and bugsnag out of the box 😄
m
I highly rate the Kermit Logger. Well thought-out library and so easy to get started with. Also quite similar to the Android Logger. I'm not the biggest fan of using 3rd-party libs in production KMP projects due to maintenance and refactors, but Kermit Logger was a strong exception.
👍 2