Skip to content

Full-feature v3 showcase example app + library fixes - #9

Merged
MoElnaggar14 merged 3 commits into
developfrom
feature/example-showcase-all
May 11, 2026
Merged

Full-feature v3 showcase example app + library fixes#9
MoElnaggar14 merged 3 commits into
developfrom
feature/example-showcase-all

Conversation

@MoElnaggar14

Copy link
Copy Markdown
Owner

Summary

Rewrites ExampleApp/SwiftMoLoggerExample from a 3-tab minimal demo into an end-to-end showcase that links and exercises every product in the package — so the app can be handed to a teammate (or to other apps' maintainers) and demonstrate the full v3 surface in one binary.

Also fixes a handful of library bugs surfaced while wiring the showcase.

Library fixes (commit 1)

  • FlightRecorder.defaultFileURL — was internal but used as the default arg of the public recoverLastSession(from:); promoted to public so adopters can actually call the API without a URL.
  • FlightRecorder.start() — always registers this recorder's private MemoryLogEngine. The previous check skipped registration whenever any MemoryLogEngine existed in the registry, silently breaking recording for adopters who wire their own first.
  • MetricKitCrashReporterMXHangDiagnostic.hangDuration is a Measurement<UnitDuration> on iOS 17+ SDK, not NSNumber-coercible. Converted via .converted(to: .milliseconds).value.
  • LogConsoleViewModel.entries — relaxed to internal(set) so @testable tests can seed entries directly (matched the existing tests).
  • FlightRecorderTests — added a setUp that resets the global registry + minimum level so previous-suite leftovers don't mask captured entries.
  • Package.swift platforms — bumped to iOS 16 / macOS 13 / tvOS 16 / watchOS 9. The UI module already uses NavigationStack + LabeledContent unguarded, so the iOS 15 declaration was incorrect.

All 70 tests pass after the changes.

Showcase app (commit 2)

  • xcodeproj: links SwiftMoLoggerUI / Network / Diagnostics / Remote / Sugar (previously only SwiftMoLogger was wired even though ContentView already imported UI). Deployment target → iOS 17.
  • SwiftMoLoggerExampleApp.configureLogging() boots the full stack in one function: Memory + System engines, ErrorGroupingEngine, RedactingLogEngine, a file engine wrapped in SamplingLogEngine + RateLimitingLogEngine, NetworkLogger.installOnSharedSession(), AppVitalsMonitor, and a FlightRecorder.
  • Six tabs:
    • Demo — every log level, error(Error), breadcrumbs, LogSignpost.measure + nested spans, the #log / #measure / @AutoLog macros, withContext, withTrace (W3C traceparent), regex redaction, and error grouping.
    • Console — bundled LogConsoleView.
    • Hub — bundled DiagnosticsHubView (timeline, network waterfall, flame graph, vitals charts, breadcrumb trail).
    • Network — real httpbin.org requests (200 / 404 / 500 / inside withTrace) flowing through NetworkLoggingProtocol, populating the Hub's waterfall and breadcrumbs live.
    • Diagnostics — live AppVitalsMonitor sample, FlightRecorder status, one-tap BugReporter bundle with ShareLink, Bonjour LiveSink toggle, and snippets for Sentry / Datadog / Loki / MetricKit.
    • About — full feature matrix for talking-points.

Test plan

  • swift test — 70/70 pass
  • xcodebuild -scheme SwiftMoLoggerExample -destination 'generic/platform=iOS Simulator' build succeeds
  • ⌘R on a simulator, click through each tab — verify Hub populates after a few minutes of activity
  • Verify the redaction tab actually shows [REDACTED] in the Console
  • Toggle LiveSink and confirm swiftmologger-inspector on macOS sees the Bonjour service

Merge develop into main for v3.0.0 release.

Preserves the full 29-commit history (no squash) so feature/fix/docs
provenance stays visible in `git log main`.

After this merge the 3.0.0 tag should be re-anchored on main HEAD and
the GitHub Release target switched to main.
- FlightRecorder.defaultFileURL: made public so it can be the default
  argument of the public recoverLastSession(from:) API (was previously
  internal, blocking adopters from calling the API without supplying a URL).
- FlightRecorder.start(): always register *this* recorder's private
  MemoryLogEngine. The previous check skipped registration whenever any
  MemoryLogEngine was already registered, silently breaking recording
  for adopters who wire their own memory engine first.
- MetricKitCrashReporter: MXHangDiagnostic.hangDuration is a
  Measurement<UnitDuration> on the iOS 17+ SDK, not NSNumber-coercible.
  Convert via .converted(to: .milliseconds).value.
- LogConsoleViewModel.entries: relax setter to internal(set) so
  @testable test cases can seed entries directly.
- FlightRecorderTests: reset the global registry + minimum level in
  setUp so previous-suite leftovers don't mask captured entries.
- Package.swift platforms: bump to iOS 16 / macOS 13 / tvOS 16 / watchOS 9
  — the UI module already uses NavigationStack + LabeledContent (iOS 16+)
  unguarded, so the iOS 15 declaration was incorrect.
Rewrites the SwiftMoLoggerExample iOS app from a 3-tab minimal demo into
an end-to-end showcase that links and exercises every product in the
package, so adopters can hand the app to a teammate and see the entire
v3 surface in motion.

What changed:
- xcodeproj: wire SwiftMoLoggerUI / Network / Diagnostics / Remote / Sugar
  as package-product dependencies (previously only SwiftMoLogger was
  linked even though ContentView already imported UI). Deployment target
  bumped to iOS 17.
- SwiftMoLoggerExampleApp: configureLogging() now boots Memory + System,
  ErrorGroupingEngine, RedactingLogEngine, a file engine wrapped in
  SamplingLogEngine + RateLimitingLogEngine, NetworkLogger on
  URLSession.shared, AppVitalsMonitor, and a FlightRecorder. One static
  function = the whole integration surface.
- ContentView: 6 tabs — Demo, Console (bundled), Hub (bundled), Network,
  Diagnostics, About. Demo tab exercises every log level, error(Error),
  breadcrumbs, LogSignpost.measure + nested spans, the #log / #measure /
  @autolog macros from SwiftMoLoggerSugar, withContext, withTrace
  (W3C traceparent), regex redaction, and error grouping.
- Network tab: real httpbin.org requests (200 / 404 / 500 / inside
  withTrace) flowing through NetworkLoggingProtocol so the Hub's
  waterfall and breadcrumbs populate live.
- Diagnostics tab: live AppVitalsMonitor sample, FlightRecorder note,
  one-tap BugReporter bundle generation with ShareLink, Bonjour LiveSink
  toggle, and snippets for Sentry / Datadog / Loki / MetricKit.
- About tab: full feature matrix — useful talking points when recommending
  the library to other apps.
- README: rewritten to match the 6-tab structure and document the full
  set of products and the boot wiring.
@MoElnaggar14
MoElnaggar14 merged commit 8db4fbe into develop May 11, 2026
13 of 19 checks passed
@MoElnaggar14
MoElnaggar14 deleted the feature/example-showcase-all branch May 11, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant