kosi-libs / canard Goto Github PK
View Code? Open in Web Editor NEWKotlin/Multiplatform lightweight logging library.
Home Page: https://kosi-libs.org/canard/
License: MIT License
Kotlin/Multiplatform lightweight logging library.
Home Page: https://kosi-libs.org/canard/
License: MIT License
Hello,
I recently started using this library and I noticed that I quite repetitively use newLogger(LoggerFactory.default)
Because it's "default", can we make it a default parameter so we can use it with just newLogger()
?
Thank you for the awesome library by the way :)
We are seeing a crash with this code flow:
Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault())
Steps to reproduce:
In particular, the function toLocalDateTime
is crashing:
Caused by: kotlin.RuntimeException: Unable to acquire the offset at instant 2021-04-06T18:14:34.809669017Z for zone Asia/Kolkata
at 0 PhoenixShared 0x0000000103a5982c kfun:kotlin.Throwable#(kotlin.String?){} + 96
at 1 PhoenixShared 0x0000000103a5198c kfun:kotlin.Exception#(kotlin.String?){} + 92
at 2 PhoenixShared 0x0000000103a51bfc kfun:kotlin.RuntimeException#(kotlin.String?){} + 92
at 3 PhoenixShared 0x0000000103c6ebcc kfun:kotlinx.datetime.TimeZone#offsetAtImpl(kotlinx.datetime.Instant){}kotlinx.datetime.ZoneOffset + 768
at 4 PhoenixShared 0x0000000103c70dd0 kfun:kotlinx.datetime#[email protected](kotlinx.datetime.Instant){}kotlinx.datetime.ZoneOffset + 188
at 5 PhoenixShared 0x0000000103c62aac kfun:kotlinx.datetime#[email protected](kotlinx.datetime.TimeZone){}kotlinx.datetime.ZoneOffset + 168
at 6 PhoenixShared 0x0000000103c71a3c kfun:kotlinx.datetime#[email protected](kotlinx.datetime.TimeZone){}kotlinx.datetime.ZonedDateTime + 268
at 7 PhoenixShared 0x0000000103c6e6fc kfun:kotlinx.datetime.TimeZone#[email protected](){}kotlinx.datetime.LocalDateTime + 272
at 8 PhoenixShared 0x0000000103c6ff9c kfun:kotlinx.datetime#[email protected](kotlinx.datetime.TimeZone){}kotlinx.datetime.LocalDateTime + 172
at 9 PhoenixShared 0x0000000103c7e620 kfun:org.kodein.log#[email protected](){}kotlin.String + 224
at 10 PhoenixShared 0x0000000103c7b3d0 kfun:org.kodein.log.frontend#printLogIn(org.kodein.log.Logger.Tag;org.kodein.log.Logger.Entry;kotlin.String?;kotlin.Function1<kotlin.String,kotlin.Unit>){} + 1052
Possible related issue
I'm facing an issue when tried to do any logging in JS in a KMM project.
I'm using the latest 0.16 version of canard, see excerpt from the build.gradle.kts
val commonMain by getting {
dependencies {
...
implementation("org.kodein.log:canard:0.16.0")
implementation("org.kodein.di:kodein-di:7.14.0")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
...
}
}
See stack trace:
Unable to resolve module @js-joda/core from <project_src>/node_modules/<js_lib_folder_name>/Kotlin-DateTime-library-kotlinx-datetime-js-ir.js: @js-joda/core could not be found within the project or in these directories:
../node_modules
1716 | //endregion
1717 | return _;
> 1718 | }(module.exports, require('@js-joda/core'), require('./kotlin-kotlin-stdlib-js-ir.js'), require('./kotlinx-serialization-kotlinx-serialization-core-js-ir.js')));
| ^
1719 |
1720 | //# sourceMappingURL=Kotlin-DateTime-library-kotlinx-datetime-js-ir.js.map
1721 |
A possible workaround I found for the issue is to add the @js-joda/core
as an npm dependency to the jsMain
sourceSet definition.
val jsMain by getting {
dependsOn(commonMain)
dependencies {
implementation(npm("@js-joda/core", "5.4.2"))
}
}
Having this in the sourceSet closure, I am able to use canard in JS and I can see the logs with the default LoggingFactory in the console.
Dear Library Maintainer,
We have just released Kotlin 1.9.21 that fixes critical issue that, in some cases, resulted in the production of incorrect klib libraries. Details: https://youtrack.jetbrains.com/issue/KT-62515
. We have detected that there are libraries built with 1.9.20 that were published to Maven Central. And these libraries are affected by the issue:
org.kodein.log:canard:1.1.0
We highly recommend you rebuilding these libraries with 1.9.21 and republishing them to minimize possible negative impact. Please take our apologies for this inconvenience. We will take the necessary measures to avoid similar issues in the future.
Kotlin Team.
Similar to: Kotlin/kotlinx-datetime#97
java.lang.NoClassDefFoundError: Failed resolution of: Ljava/time/Instant;
at kotlinx.datetime.Instant.<clinit>(Instant.kt:94)
at kotlinx.datetime.Clock$System.now(Clock.kt:14)
at org.kodein.log.InstantDateTimeKt.now(instantDateTime.kt:9)
at org.kodein.log.Logger$Entry.<init>(Logger.kt:90)
at org.kodein.log.Logger.createEntry(Logger.kt:94)
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.