AAkira / Napier

Logging library for Kotlin Multiplatform
Apache License 2.0
820 stars 36 forks source link

Add caller info by allow comfortable usage from iOS part #86 #87

Closed PhilipDukhov closed 3 years ago

PhilipDukhov commented 3 years ago

This is fix for #86.

Swift stack trace doesn't looks easy to parse.

This is how call from ViewController.configure like looks:

$s6Napier14ViewControllerC9configure33_527BB3C17EFDCFA47CE221EFAC2390B7LLyyF + 528

If the cal is made from a struct, it looks much different. Here's stack trace line of Test().pr() and Test.pr() lines:

$s6Napier4TestV2pryyF + 84 // instance method
$s6Napier4TestV2pryyFZ + 84 // static method

What's usually done in iOS is passing function name with #function and file name with #file, check out apple/swift-log as a reference.

That's why this PR is adding a parameter to be passed from Swift code. Also I've added usage examples.

PhilipDukhov commented 3 years ago

I found a lot simpler solution, opened #88 instead