Git Product home page Git Product logo

Comments (11)

KevinnZou avatar KevinnZou commented on June 20, 2024 1

@kpgalligan Are there any updates?

from kermit.

kpgalligan avatar kpgalligan commented on June 20, 2024 1

Added my changes https://github.com/kpgalligan/compose-webview-multiplatform

from kermit.

kpgalligan avatar kpgalligan commented on June 20, 2024

Which version of Kermit? How is your Kermit configured? What log writer(s) are you using?

from kermit.

KevinnZou avatar KevinnZou commented on June 20, 2024

I am using version 2.0.0-RC5. I tried it in several ways but all failed.

  1. Directly using the global Logger
    Logger.d { "" }
  2. Using global Logger and set min severity first
Logger.setMinSeverity(Severity.Debug)
Logger.d { "" }
  1. Using a custom Logger
internal object KLogger : Logger(
    config = loggerConfigInit(
        platformLogWriter(DefaultFormatter),
        minSeverity = Severity.Debug
    ),
    tag = "ComposeWebView"
)

All three ways do not work and it will only print out the logs with Logger.i or higher severity. They work fine on Android and Desktop platforms

from kermit.

KevinnZou avatar KevinnZou commented on June 20, 2024

@kpgalligan You can directly test this project https://github.com/KevinnZou/compose-webview-multiplatform. Logger.d works well on Android and Desktop but fails on iOS.

from kermit.

kpgalligan avatar kpgalligan commented on June 20, 2024

I added this:

fun MainViewController() = ComposeUIViewController {
    Logger.v { "Verbose" }
    Logger.d { "Debug" }
    Logger.i { "Info" }
    Logger.w { "Warn" }
    Logger.e { "Error" }
    WebViewApp()
}

This was printed in the Xcode log:

⚪️ Verbose
🔵 Debug
🟢 Info
🟡 Warn
🔴 Error
Screenshot 2023-10-26 at 8 11 35 AM

If you're not seeing this, then I'm guessing you have a min log set in Xcode?

from kermit.

KevinnZou avatar KevinnZou commented on June 20, 2024

@kpgalligan Thanks for your reply! I am wondering did you test the log in Android Studio? Since we can directly run iosApp in Android Studio and see logs in the console, we don't need to open Xcode at all.

from kermit.

kpgalligan avatar kpgalligan commented on June 20, 2024

I never run iOS apps from Android Studio :) Hmm.

from kermit.

kpgalligan avatar kpgalligan commented on June 20, 2024

I've looked at it in AS. I can't find any config to set the level that is logged there. I assume the KMM plugin for AS is not showing everything for whatever reason. By that I mean they've made a decision to not show OS_LOG_TYPE_DEBUG statements in the log for whatever reason.

I will need to think about how to make some kind of config for the Apple-side log writer to allow you to override how that log writer works by default. We can't (AFAIK) detect if you're in AS, Xcode, or nothing. I also don't really want to force all verbose and debug statements to output at OS_LOG_TYPE_INFO solely because of the KMM AS plugin.

So, maybe there's a way to pass a param to platformLogWriter, but that's a pretty specific param for a global helper. Maybe just OSLogWriter/XcodeSeverityWriter, but then the out-of-the-box experience isn't ideal.

Anyway, for reference, here's the code mapping log levels:

private fun kermitSeverityToOsLogType(severity: Severity): UByte = when (severity) {
        Severity.Verbose, Severity.Debug -> OS_LOG_TYPE_DEBUG
        Severity.Info -> OS_LOG_TYPE_INFO
        Severity.Warn -> OS_LOG_TYPE_DEFAULT
        Severity.Error -> OS_LOG_TYPE_ERROR
        Severity.Assert -> OS_LOG_TYPE_FAULT
    }

If I'd known about this earlier I would've at least made that open and not private, so writing a custom version would involve minimal code.

I think this needs to have a bug filed for the KMM Plugin for AS, as it is dropping log statements. You should be able to select your own filter there, similar to Logcat's view

Screenshot 2023-10-26 at 3 15 33 PM

from kermit.

KevinnZou avatar KevinnZou commented on June 20, 2024

@kpgalligan Thank you for your reply! I truly appreciate your investigation. I also attempted to run the app in Xcode and was able to see all the logs. Therefore, as you mentioned, the issue lies with the KMM Plugin for AS. I will open an issue with them. Thank you once again for your help!

from kermit.

hanrw avatar hanrw commented on June 20, 2024

same issue with AppCode but not Xcode
AppCode show below

2024-03-10 22:35:21.140636+0800 Mint[29800:899637] 🟢 info
2024-03-10 22:35:21.140694+0800 Mint[29800:899637] 🟡 warning
2024-03-10 22:35:21.140731+0800 Mint[29800:899637] 🔴 error

Xcode shows below

🔵 debug
🟢 info
🟡 warning
🔴 error

from kermit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.