Pretty sure we've touched on this before. In any case, please add let fileName: StaticString
, which is equivalent to lastPathComponent without having to import Foundation.
See also:
- SE-0028 Debugging Identifier #filename - #2 by Erica_Sadun
- [Pitch] Introducing #fileName debug identifier
- https://github.com/apple/swift-evolution/blob/master/proposals/0028-modernizing-debug-identifiers.md
SR-198 requested the coalescing of existing identifiers. A structured #sourcelocation identifier could be added as a follow-on if and when the Swift team decides to tackle a standardized source location type, which would provide individual field or keyword access.
In support of summaries, Remy Demerest writes, "[I] love the idea that source location would be one object that you can print to get the full story while still retaining the possibility to use each individual components as needed, which is probably the rarer case. I never find myself wanting only some of properties and usually don't include them simply because it takes longer to write the format properly, if I can get them all in one go it's certainly a win."
Should such a type be adopted, I'd recommend support for common output summary representations suitably differentiated for debug and release logging. Alternatively #context, #releasecontext, and #debugcontext summaries could be added independently of the adoption of #sourcelocation.