Comments (11)
@kpgalligan Are there any updates?
from kermit.
Added my changes https://github.com/kpgalligan/compose-webview-multiplatform
from kermit.
Which version of Kermit? How is your Kermit configured? What log writer(s) are you using?
from kermit.
I am using version 2.0.0-RC5. I tried it in several ways but all failed.
- Directly using the global Logger
Logger.d { "" }
- Using global Logger and set min severity first
Logger.setMinSeverity(Severity.Debug)
Logger.d { "" }
- 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.
@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.
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](https://private-user-images.githubusercontent.com/68384/278325361-5e2a669b-1f37-443d-af63-8c4f2c8deb0a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTU1NDQzMjgsIm5iZiI6MTcxNTU0NDAyOCwicGF0aCI6Ii82ODM4NC8yNzgzMjUzNjEtNWUyYTY2OWItMWYzNy00NDNkLWFmNjMtOGM0ZjJjOGRlYjBhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTEyVDIwMDAyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQzMjZmYjEzZjdjY2UyNjFhMjljZjQwN2I0ZTRlOGVkNjZmYzYxYzA4NWVjYzU2NzRmMTMzYmI2YjU4NmNiMjImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lNkA2kmcCmgmydVhi393Urie1VPsF4nPu3DjwQE7KfI)
If you're not seeing this, then I'm guessing you have a min log set in Xcode?
from kermit.
@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.
I never run iOS apps from Android Studio :) Hmm.
from kermit.
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](https://private-user-images.githubusercontent.com/68384/278451482-a877e146-6bae-4a24-a4ad-a17bf1ebc60c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTU1NDQzMjgsIm5iZiI6MTcxNTU0NDAyOCwicGF0aCI6Ii82ODM4NC8yNzg0NTE0ODItYTg3N2UxNDYtNmJhZS00YTI0LWE0YWQtYTE3YmYxZWJjNjBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA1MTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNTEyVDIwMDAyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYwMTMyZjc4MjJkMTVjZjdkMjgyZmI1Mjc1ZTZjYzFiZjE0YjgxZDhkNGZhZmIzZmI2ODFiN2MzYzU3MmVjYzEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.tVmfOE-WtLod0HzRWh_a6X3feQQp1YsYY1A3_rNrj5Y)
from kermit.
@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.
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)
- Support for the new kotlin WASM target HOT 6
- Logger default arguments not usable in non-Kotlin and non-Java code HOT 5
- Support for linuxArm64 target
- Tag function broken in 2.0.1 HOT 2
- Kermit not using default parameters in iOS with the version 2.0.0 and above
- `sample-production` test is causing Bugsnag link issue
- EXC_BAD_ACCESS (code=1, address=0x68000) when logging Ktor network response on iOS (Simulator only) HOT 3
- Error: Could not find "co.touchlab:stately-iso-collections" in js test target HOT 2
- Kermit changelog HOT 3
- Could not resolve org.jetbrains.kotlin:kotlin-test-junit5:1.9.10 HOT 4
- Investigate logging Error and NSError for Apple targets
- JUnit dependency in runtime classpath HOT 4
- Allow `LogWriter` to pass down attributes/metadata
- Feature Request: CrashlyticsLogWriter should allow setting the FirebaseCrashlytics instance
- Cannot build iOS with co.touchlab:kermit-crashlytics HOT 5
- Feature Request: Support for CLI applications
- Feature Request: Structured Logging with Xcode 15
- Logs are not chunked on Android HOT 5
- Stack trace on iOS is not shown by default in the OS logs HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kermit.