touchlab / kermit Goto Github PK
View Code? Open in Web Editor NEWKermit by Touchlab is a Kotlin Multiplatform centralized logging utility.
Home Page: https://kermit.touchlab.co
License: Apache License 2.0
Kermit by Touchlab is a Kotlin Multiplatform centralized logging utility.
Home Page: https://kermit.touchlab.co
License: Apache License 2.0
Hello ๐
I am having exception during my test. This issue happen on androidTest
in common module.
java.lang.RuntimeException: Method println in android.util.Log not mocked. See http://g.co/androidstudio/not-mocked for details.
at android.util.Log.println(Log.java)
at co.touchlab.kermit.LogcatLogger.log(LogcatLogger.kt:27)
at com.github.mustafaozhan.logmob.LogMobLogger.log(LogMobLogger.kt:26)
at co.touchlab.kermit.Logger.d(Logger.kt:22)
at co.touchlab.kermit.Kermit.d(Kermit.kt:43)
at co.touchlab.kermit.Kermit.d$default(Kermit.kt:42)
at co.touchlab.kermit.Kermit.d(Kermit.kt:47)
at com.github.mustafaozhan.ccc.common.BaseRepositoryTest.init(BaseRepositoryTest.kt:18)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.RunBefores.invokeMethod(RunBefores.java:33)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:119)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:834)
1 test completed, 1 failed
It happens on
@BeforeTest
fun init() {
application = initKoin()
platformRepository = application.koin.get(PlatformRepository::class)
}
and it has a simple logging inside.
fun initKoin(vararg modules: Module?) = startKoin {
kermit.d { "initialising koin" }
modules.forEach { it?.let { modules(it) } }
modules(commonModule)
}
I know i can just remove the logging :) but just wanted to report since we may have logging in many places :)
It only happens if I use LogcatLogger
for android, doesn't occur if i use CommonLogger
.
I prefer to use LogcatLogger since it has different colors in logcat but because of this exception I am kind a forced to use CommonLogger.
It looks like the ide is creating artifact xml files in the .idea folder. Should these be ignored in git?
Use Apache 2.0
We currently pass the message via a function parameter that only get's invoked if a logger returns true for isLoggable. The idea was to prevent unnecessary string allocation if a log isn't going to be outputted, but I worry that it may have more negative performance implications than positive at the moment.
First, we call the block multiple times, once for each loggable logger. We should optimize to only invoke it once if there is a loggable logger and reuse it for any others. There is also a performance impact for invoking functions which may outweigh string allocation.
There is room for potential gradle improvemetns. See:
#36 (comment)
Need to decide on where the eventual public artifact will be published. Start publishing private versions if that's possible. Update readme to show including the dependency
All the examples I've seen seem to make use of "co.touchlab.native.cocoapods" ....is there example of exporting using "standard" CocoaPods plugin (https://kotlinlang.org/docs/reference/native/cocoapods.html)?
On native, default stack trace only prints a few lines, which is pretty useless. Need to look if that's being capped by Kermit or something else
We currently dont handle throwables in any of our prebuilt loggers.
When a kotlin crash happens, we want to write the stack trace leading up to it, then let the platform crash on it's own. That results in 2 reports. One handled and one not. This is know behavior. However, it would be good to be able to trace between the two reports. We're adding custom data values that have an id that can match. Currently, however, searching doesn't find the key data. We should explore what fields are searchable by crashlytics (if any), and put the id in a field that is searchable.
https://jcenter.bintray.com/co/touchlab/kermit/
Please add 0.1.7-1.4.0
The Kermit library currently has the cocoapods plugin installed and a podspec in the library root. This isn't needed as the library is included directly in KMP libraries. Just have to remove the plugin application, configuration, classpath in settings.gradle, and podspec
Make the CrashlyticsLogger an expect class with different platform implementations. Could make separate classes per platform, but there's not a lot that I think we need to have platform specific in the interface, so we can make Kermit init simpler with an expect class.
Starting with at least JS, JVM, Apple
Perhaps in it's own readme we should have some instructions on how to use the sample. This should include usage of publishToMavenLocal
to get updates of the library and any platform specific info such as how to use JS
When a kotlin crash happens, we want to write the stack trace leading up to it, then let the platform crash on it's own. That results in 2 reports. One handled and one not. This is know behavior. However, it would be good to be able to trace between the two reports. We're adding custom data values that have an id that can match. Currently, however, searching doesn't find the key data. We should explore what fields are searchable by bugsnag (if any), and put the id in a field that is searchable.
If #249 works out, this bug is irrelevant.
Probably with something like kermit.withTag("Tag")
which returns a new copy of kermit
The ios Sample doesnt currently build for some reason. Fix that
Currently only minimal testing. Need a more robust suite
Simple sample app for bugsnag
Support a global kermit config which has the appropriate threading protection but make it's performance restrictions clear
We currently only accept lambda's for the message parameter. This ensures we dont evaluate the string if no logger cares about it. This is good but a little clunky if you dont care about that. Consider adding a string only version
More of a thinking task. How would we modify the api to make Swift access simpler?
If we can get the current log level, we can override isLoggable and limit logging
Make the BugsnagLogger an expect class with different platform implementations. Could make separate classes per platform, but there's not a lot that I think we need to have platform specific in the interface, so we can make Kermit init simpler with an expect class.
Bugsnag has a lot of platforms available. We should see which we really want to cover. Android/jvm for sure, but JS and maybe server.
Simple sample app for Crashlytics
Our current jvm target is specifically Android. Need to add JVM only as well
Currently we log the throwable string as a fault. Should we instead match the severity that it got passed in at? Maybe the caller wanted to print a relatively benign throwable at a lower severity
With pre-release disclaimer and design philosophy
When using this library with a js(IR) target I have this error:
Could not determine the dependencies of task ':shared:jsPackageJson'.
> Could not resolve all dependencies for configuration ':shared:jsNpm'.
> Could not resolve co.touchlab:kermit:0.1.8.
Required by:
project :shared
> No matching variant of co.touchlab:kermit:0.1.8 was found. The consumer was configured to find a usage of 'kotlin-runtime' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js', attribute 'org.jetbrains.kotlin.js.compiler' with value 'ir'
I suppose you just need to add js(IR) to your targets, but I never developed a multiplatform library so I'm not sure :)
Static Kermit config is better for performance, but there may be use cases for dynamic config. I think this can be enabled with some config magic. To explore.
Not a ton of functionality here, but it would be good to review for tests
How do we interact with crashkios and crash report tools like crashlytics. Might need modules with dependencies. might need to direct people to route interfaces to kermit
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.