Closed stumi01 closed 4 years ago
@AAkira
Any news on this?
@stumi01 @RomeuG
Do you mean to define a separate Level that is currently nested in the Napier class?
@ThreadLocal
object Napier {
enum class Level {
VERBOSE,
...
}
....
}
enum class Level {
VERBOSE,
...
}
@ThreadLocal
object Napier {
....
}
I think yes, that would solve the issue because the name problem comes from the fact that the Level
enum is embedded inside the Napier
object but I'm not 100% sure.
@stumi01 @RomeuG
I published it as 1.5.0-alpha1
.
Please check it.
Napier.Level
has been renamed to LogLevel
.
@AAkira @stumi01
Hi, I tried with the version.
import UIKit
import Common
final class SwiftAntilog: NapierAntilog {
override func performLog(priority: NapierLogLevel, tag: String?, throwable: KotlinThrowable?, message: String?) {
print("Swift: \(message ?? "")")
}
}
final class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
NapierProxyKt.releaseBuild(antilog: SwiftAntilog())
Sample().hello()
DispatchQueue.global(qos: .background).async {
// Without the below code, SwiftAntilog won't appear because Napier is ThreadLocal object.
// NapierProxyKt.releaseBuild(antilog: SwiftAntilog())
Sample().hello()
}
}
}
// Console
// Swift: Hello napier
// Swift: optional tag
Is this behavior you expect?
You can try this code with mpp-sample in Napier repository.
@AAkira Perfect, thank you.
@horita-yuya Thank you for your support! 🥺
@AAkira
I guess there isn't any version of this patch for Kotlin 1.3.72 ?
Actually, I can publish it for 1.3.72. But I don't recommend using the old Kotlin version in KMP.
Can you do it, if possible?
I understand what you mean, but in my current project, it is a bit early to update to 1.4.0. It's not like the differences are that huge from 1.3.72.
Regardless, I leave that to you, if you want to publish or not. :-)
I'm sorry I don't want to publish it. 🙇♂️
As you know, it's a very complicated updated from Kotlin 1.3.x to 1.4.x. I have to revert this if I publish it. https://github.com/AAkira/Napier/pull/46/files
It's okay, I have to live with the warning for a while then. Thank you.
Usecase: We want to create subclass of the Antilog abstract class in swift.
The warning is the following:
Because of it we cannot use anything which relates to the Napier.Level enum from swift code, therefore the Antilog superclass is empty.
As a workaround we created a similar class like the
CrashlyticsAntilog
in the example but would be better a bit if the library would not produce a warning.