Alicerce icon indicating copy to clipboard operation
Alicerce copied to clipboard

Add result builders to `MultiLogger` and `MultiTracker`s 👷

Open p4checo opened this issue 2 years ago • 1 comments

Checklist

  • [x] I've rebased my changes on top of master
  • [x] I've built and run the project to see all new and existing tests pass
  • [x] I've followed the Mindera swift style guide
  • [x] I've read the Contribution Guidelines
  • [x] I've updated the documentation if necessary.

Motivation and Context

Some of our "multiplexer" instances for logging (Log.MultiLogger), analytics (Analytics.MultiTracker) and performance metrics (PerformanceMetrics.MultiTracker) require type erasure on the child elements to which they forward events, causing the setup to be cumbersome and not intuitive.

By leveraging result builders we can make this a bit smoother to users by abstracting/automating the type erasure "dance". Furthermore, it unlocks control flow (e.g. if/else, for ... in, if #available) which allows more advanced setups to be defined directly in the builder.

Description

  • Add result builders to facilitate instantiating certain "multiplexer" instances, most notably the ones that require type erasure:

    • Log.MultiLogger (requires erasing to AnyMetadataLogDestination)

    • Analytics.MultiTracker (requires erasing to AnyAnalyticsTracker)

    • PerformanceMetrics.MultiTracker (doesn't require erasing)

  • Add relevant UTs.

p4checo avatar Apr 07 '23 22:04 p4checo

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 95.18%. Comparing base (40b1f63) to head (dfd5bdc).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #265      +/-   ##
==========================================
+ Coverage   95.09%   95.18%   +0.08%     
==========================================
  Files         101      101              
  Lines        3384     3445      +61     
==========================================
+ Hits         3218     3279      +61     
  Misses        166      166              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 07 '23 23:04 codecov[bot]