Stefan Oltmann
07/22/2021, 7:21 AMStefan Oltmann
07/22/2021, 7:30 AMStefan Oltmann
07/22/2021, 7:32 AMStefan Oltmann
07/22/2021, 7:48 AMStefan Oltmann
07/22/2021, 8:24 AMMustafa Ozhan
07/22/2021, 8:53 AMStefan Oltmann
07/22/2021, 8:55 AMMustafa Ozhan
07/22/2021, 9:16 AMStefan Oltmann
07/22/2021, 9:20 AMStefan Oltmann
07/22/2021, 9:38 AMStefan Oltmann
07/22/2021, 9:41 AMMustafa Ozhan
07/22/2021, 9:45 AMMustafa Ozhan
07/22/2021, 9:46 AMStefan Oltmann
07/22/2021, 9:47 AMStefan Oltmann
07/22/2021, 9:48 AMStefan Oltmann
07/22/2021, 9:50 AMios {
binaries {
framework {
baseName = "shared"
embedBitcode("bitcode")
}
}
}
macosX64("macos") {
binaries {
framework {
baseName = "shared"
}
}
}
val buildXcFramework by tasks.registering {
dependsOn("deleteXcFramework")
group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val frameworks = arrayOf("iosArm64", "iosX64", "macos")
.map { kotlin.targets.getByName<KotlinNativeTarget>(it).binaries.getFramework(mode) }
inputs.property("mode", mode)
dependsOn(frameworks.map { it.linkTask })
doLast { buildXcFramework(frameworks) }
}
fun Task.buildXcFramework(frameworks: List<org.jetbrains.kotlin.gradle.plugin.mpp.Framework>) {
val buildArgs: () -> List<String> = {
val arguments = mutableListOf("-create-xcframework")
frameworks.forEach {
arguments += "-framework"
arguments += "${it.outputDirectory}/${project.name}.framework"
}
arguments += "-output"
arguments += xcFrameworkPath
arguments
}
exec {
executable = "xcodebuild"
args = buildArgs()
}
}
tasks.getByName("build").dependsOn(buildXcFramework)
Stefan Oltmann
07/22/2021, 9:51 AMMustafa Ozhan
07/22/2021, 9:54 AMLogger.kt
file in your shared code and inside you will have kermit
as variable.
then you will be able to reach in iOS/macOS like this
LoggerKt.kermit.d(withMessage: {"some log"})
Stefan Oltmann
07/22/2021, 9:56 AMMustafa Ozhan
07/22/2021, 9:58 AMStefan Oltmann
07/22/2021, 9:59 AMStefan Oltmann
07/22/2021, 10:35 AMMustafa Ozhan
07/22/2021, 1:34 PMkermit
appending in logcatMustafa Ozhan
07/22/2021, 1:34 PMkermit
Stefan Oltmann
07/22/2021, 1:35 PMStefan Oltmann
07/22/2021, 1:39 PMStefan Oltmann
07/22/2021, 1:40 PMStefan Oltmann
07/22/2021, 1:44 PMMustafa Ozhan
07/22/2021, 1:45 PMStefan Oltmann
07/22/2021, 2:34 PMfirebase-crashlytics-gradle
plugin that the doc says that should be added and it works?
For me it says Make sure to call FirebaseApp.initializeApp(Context) first.
but your app doesn't do thatkpgalligan
07/22/2021, 2:44 PMkpgalligan
07/22/2021, 2:51 PMYou project is absolutely on the right track and helps where Kermit alone falls short. 👍
One-shot enabling logging with analytics & crashlytics is what every App should need and you make it easy. I like.
Stefan Oltmann
07/22/2021, 2:53 PMStefan Oltmann
07/22/2021, 2:54 PMkpgalligan
07/22/2021, 2:55 PMStefan Oltmann
07/22/2021, 2:55 PMkpgalligan
07/22/2021, 2:56 PMStefan Oltmann
07/22/2021, 2:56 PMCasey Brooks
07/22/2021, 2:56 PMkpgalligan
07/22/2021, 2:57 PMkpgalligan
07/22/2021, 2:57 PMIn my observations, it’s hard to really make a “good” logging library, because everyone needs such vastly different things from itThis, 100%
kpgalligan
07/22/2021, 2:57 PMStefan Oltmann
07/22/2021, 2:58 PMStefan Oltmann
07/22/2021, 2:58 PMkpgalligan
07/22/2021, 3:02 PMkpgalligan
07/22/2021, 3:04 PMkpgalligan
07/22/2021, 3:08 PMCasey Brooks
07/22/2021, 3:08 PMkpgalligan
07/22/2021, 3:11 PMkpgalligan
07/22/2021, 3:12 PMkpgalligan
07/22/2021, 3:12 PMCasey Brooks
07/22/2021, 3:14 PMClog.i("a log here")
. That accesses the mutable atomic variable to log to the globally-configured ClogProfile
, which is the immutable logger.
To get a static logger for runtime use, you’d call Clog.getInstance()
or Clog.tag("some tag")
and cache that as you would any other normal logger.
There are also a set of lambda-based functions d("optional tag) { "a log message" }
but I’m probably going to end up removing those soon because they access the global internally. I’d like to make similar functions in a Compose context, which use CompositionLocals for the “global instance” instead, which would conflict with these functionskpgalligan
07/22/2021, 3:17 PMbut I’m probably going to end up removing those soon because they access the global internallyAre you removing them because they access the global or just not changing them because you don't really use them? I mean, in theory, they wouldn't need to access the global, unless that's how you're checking log level before evaling the lambda?
kpgalligan
07/22/2021, 3:18 PMCasey Brooks
07/22/2021, 3:25 PMCasey Brooks
07/22/2021, 3:31 PMkpgalligan
07/22/2021, 3:34 PMkpgalligan
07/22/2021, 3:35 PMMustafa Ozhan
07/22/2021, 4:02 PMStefan Oltmann
07/22/2021, 4:15 PMStefan Oltmann
07/22/2021, 4:49 PMStefan Oltmann
07/22/2021, 8:56 PMReed Ellsworth
07/22/2021, 10:45 PMReed Ellsworth
07/22/2021, 10:47 PMReed Ellsworth
07/22/2021, 10:52 PMReed Ellsworth
07/22/2021, 11:20 PMkpgalligan
07/22/2021, 11:24 PMand only one static boolean flag check whether that log level is enabledIn the main thread, yes? I looked at the boolean vars in https://github.com/LighthouseGames/KmLogging/blob/main/logging/src/commonMain/kotlin/org/lighthousegames/logging/KmLogging.kt#L6 and it looks like they're thread local, unless I'm missing something. Kermit's approach to passing lambdas is similar, although you're using inline functions, which would avoid a function call (at the expense of inline function binary, perhaps).
kpgalligan
07/22/2021, 11:25 PMReed Ellsworth
07/22/2021, 11:26 PMkpgalligan
07/22/2021, 11:26 PMReed Ellsworth
07/22/2021, 11:28 PMkpgalligan
07/22/2021, 11:28 PMkpgalligan
07/22/2021, 11:29 PMkpgalligan
07/22/2021, 11:30 PMkpgalligan
07/22/2021, 11:32 PMisLoggingVerbose
is true, but it would log it nowhere, so you'd probably not know about itkpgalligan
07/22/2021, 11:32 PMkpgalligan
07/22/2021, 11:32 PMkpgalligan
07/22/2021, 11:33 PMkpgalligan
07/22/2021, 11:33 PMReed Ellsworth
07/22/2021, 11:38 PMReed Ellsworth
07/22/2021, 11:40 PMkpgalligan
07/22/2021, 11:42 PMkpgalligan
07/22/2021, 11:45 PMkpgalligan
07/22/2021, 11:46 PMkpgalligan
07/22/2021, 11:46 PMlog.d { "Inserting ${breeds.size} breeds into database" }
Reed Ellsworth
07/22/2021, 11:51 PMReed Ellsworth
07/22/2021, 11:53 PMkpgalligan
07/22/2021, 11:56 PMKermits overhead is on each disabled log call is a 1-3 method calls plus the following:Agree. It's part of the internal discussion on refresh.
kpgalligan
07/22/2021, 11:57 PMkpgalligan
07/22/2021, 11:58 PMkpgalligan
07/22/2021, 11:59 PM