https://github.com/markbattistella/simpleloggerui
SimpleLoggerUI is a Swift package that provides a set of convenient SwiftUI views to easily integrate logging functionalities into your iOS or macOS applications. This package allows developers to display, filter, and export log entries without the need to build custom interfaces from scratch.
https://github.com/markbattistella/simpleloggerui
hacktoberfest ios ipados logger macos oslog swift swiftui visionos
Last synced: about 2 months ago
JSON representation
SimpleLoggerUI is a Swift package that provides a set of convenient SwiftUI views to easily integrate logging functionalities into your iOS or macOS applications. This package allows developers to display, filter, and export log entries without the need to build custom interfaces from scratch.
- Host: GitHub
- URL: https://github.com/markbattistella/simpleloggerui
- Owner: markbattistella
- License: mit
- Created: 2024-09-11T05:14:12.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-16T23:41:44.000Z (over 1 year ago)
- Last Synced: 2025-05-09T11:17:51.737Z (10 months ago)
- Topics: hacktoberfest, ios, ipados, logger, macos, oslog, swift, swiftui, visionos
- Language: Swift
- Homepage: https://swiftpackageindex.com/markbattistella/SimpleLoggerUI/documentation
- Size: 17.7 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SimpleLoggerUI



`SimpleLoggerUI` is a Swift package that provides a complete, ready-to-use SwiftUI interface for inspecting logs collected via the [`SimpleLogger`](https://github.com/markbattistella/SimpleLogger) package.
It includes a full log list screen with filtering, exporting, and platform-appropriate UI behaviour for iOS, macOS, iPadOS, 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
- macOS and iOS-appropriate interaction patterns
## Installation
Add `SimpleLoggerUI` using Swift Package Manager.
```swift
dependencies: [
.package(
url: "https://github.com/markbattistella/SimpleLoggerUI",
from: "1.0.0"
)
]
```
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.
```swift
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
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.
- **Copy to clipboard:** Copies UTF-8 text in the selected format (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.