Closed PhilipDukhov closed 3 years ago
I found out that I can use log
instead of a specific version, which will decrease the stack trace count to expected, but this still doesn't work as expected because iOS stack trace format is different from the kotlin one:
6 Napier 0x0000000100869644 kfun:io.github.aakira.napier.Napier#d(kotlin.String;kotlin.Throwable?;kotlin.String?){} + 280
7 Napier 0x0000000100913d28 objc2kotlin.259 + 252
8 Napier 0x00000001007f0e6c $s6Napier14ViewControllerC9configure33_527BB3C17EFDCFA47CE221EFAC2390B7LLyyF + 752
I'll try to parse it correctly and come back with the pull request
I would like to use Napier in iOS part as well. This is not very convenient because Kotlin Native has some limitations:
throwable
andtag
in every call.static
function, andshared
/Companion()
must be specified manually.() -> String
methods, the argument nametag
cannot be used in both cases, and theString
variant has the nametag_
.So my log code can look like this:
As far as I know, you can't do anything about these problems in kotlin part. That's why I wrote such a wrapper in Swift:
Everything works as expected, with one exception: because you use a constant stack trace index, the function name calculation is no longer correct.
I thought about adding another optional parameter to all calls that would indicate the shift in wrappers like mine, something like this:
But maybe you can come up with a more elegant solution