Skip to content

Latest commit

 

History

History
156 lines (107 loc) · 4 KB

File metadata and controls

156 lines (107 loc) · 4 KB

SimpleLoggerUI

Swift Versions

Platforms

Licence

SimpleLoggerUI is a Swift package that provides a complete, ready-to-use SwiftUI interface for inspecting logs collected via the SimpleLogger package.

It includes a full log list screen with filtering, exporting, and platform-appropriate UI behaviour for iOS, macOS, iPadOS, tvOS, watchOS, and visionOS—without requiring you to build or manage any custom logging UI.

Features

  • Log list screen

    • Displays logs with timestamp, level, subsystem, category, and message
    • Visual styling adapts to log severity for improved scan-ability
    • Pull-to-refresh support
  • Filtering

    • Exclude system logs
    • Filter by:
      • Specific date
      • Date range
      • Hour range (within a single day)
      • Preset ranges (e.g. recent periods)
    • Filter by log level with multi-selection support
  • Exporting

    • Export formats:
      • Plain log
      • JSON
      • JSON Lines
      • CSV (configurable delimiter)
    • Optional gzip compression for file exports
    • Export to file system or copy directly to clipboard
  • Cross-platform

    • Adaptive navigation and toolbar behaviour
    • Native file exporter integration where supported
    • Clipboard export on platforms with a writable system clipboard
    • Platform-appropriate interaction patterns

Requirements

  • Swift 6.0+
  • iOS 17.0+
  • macOS 14.0+
  • Mac Catalyst 17.0+
  • tvOS 17.0+
  • watchOS 10.0+
  • visionOS 1.0+

Installation

Add SimpleLoggerUI using Swift Package Manager.

dependencies: [
  .package(
    url: "https://github.com/markbattistella/SimpleLoggerUI", 
    from: "26.2.21"
  )
]

Alternatively, you can add SimpleLoggerUI using Xcode by navigating to File > Add Packages and entering the package repository URL.

Usage

LogListScreen

LogListScreen is the primary entry point. It manages fetching, filtering, and exporting logs internally using LoggerManager.

![IMPORTANT] You do not need to supply logs manually.

import SwiftUI
import SimpleLoggerUI

struct ContentView: View {
  var body: some View {
    NavigationStack {
      LogListScreen()
    }
  }
}

LogListScreen automatically:

  • Fetches logs on appearance
  • Supports pull-to-refresh
  • Provides toolbar actions for filtering and exporting
  • Displays loading and empty states

Filtering Logs

Tap Filter in the toolbar to open the filter sheet.

Available filter modes:

Specific date

View logs recorded on a single calendar day.

Date range

View logs across multiple days (inclusive).

Hour range

Select a date and restrict logs to a specific hour window.

Preset

Quickly apply commonly used time ranges.

You can also:

  • Exclude system logs
  • Select which log levels are visible
  • Filter changes are applied immediately.

Exporting Logs

On iOS, macOS, Mac Catalyst, and visionOS, tap Export in the toolbar to open the export sheet.

Export options

  • Output formats:
    • .log
    • .json
    • .jsonl
    • .csv
  • CSV delimiter selection
  • Optional gzip compression (file exports only)

Export destinations

  • Export to file: Saves the export via the system file picker where file moving is available.
  • Copy to clipboard: Copies UTF-8 text in the selected format where a writable system clipboard is available (compression ignored).

Contributing

Contributions are welcome! Please fork the repository and submit a pull request for any features, fixes, or improvements.

License

SimpleLoggerUI is available under the MIT license. See the LICENCE file for more information.