Swiftpack.co -  grigorye/GETracing as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
grigorye/GETracing
Seamless tracing for Swift.
.package(url: "https://github.com/grigorye/GETracing.git", from: "0.1.2")

Actions Status

GETracing

Easily trace value and literal of a Swift expression right at the point of evaluation.

Why

  • Avoid repeating yourself.
  • Avoid introducing variables just to keep a value of expression (otherwise re-evaluated) for logging. Evaluate just once, whether there's tracing or not.
  • Get the expression literals traced in addition to the values.
  • Keep the code changes to the minimum. Make tracing (and reverting from tracing) as seamless as possible.

What

Any Swift expression

expr

that needs tracing is replaced with

x$(expr)

and that's it. Nested expressions might be traced as well.

Configration

x$ alternative might be defined as necessary by the client.

Logging implementation should be defined by the client.

Reverting

Tracing might be reverted by removal of x$() or even removal of x$, leaving () in place.

Alternatively, tracing might be disabled per-block.

Current Limitations

It's required to bundle the corresponding source files together with the modules, if you want to see the expression literals for the traced stuff, as they're looked up at runtime. It might be improved later. For now, for performance reasons, it's possible to disable the lookup completely. (Theoretically) it's possible to recover the literals given the traced output with lookups disabled.

Related Projects

Tuna Xcode Plugin

GitHub

link
Stars: 1
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

2 years ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API