https://github.com/0xwdg/oslogviewer
OSLogViewer is made for viewing your apps OS_Log history, it is a SwiftUI view which can be used in your app to view and export your logs.
https://github.com/0xwdg/oslogviewer
0xwdg hacktoberfest logger oslog oslogviewer spm swift swift-lang swiftui
Last synced: about 1 year ago
JSON representation
OSLogViewer is made for viewing your apps OS_Log history, it is a SwiftUI view which can be used in your app to view and export your logs.
- Host: GitHub
- URL: https://github.com/0xwdg/oslogviewer
- Owner: 0xWDG
- License: mit
- Created: 2024-06-01T15:22:35.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-17T20:46:42.000Z (about 1 year ago)
- Last Synced: 2025-05-04T20:45:14.336Z (about 1 year ago)
- Topics: 0xwdg, hacktoberfest, logger, oslog, oslogviewer, spm, swift, swift-lang, swiftui
- Language: Swift
- Homepage: https://0xwdg.github.io/OSLogViewer/
- Size: 1.33 MB
- Stars: 20
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OSLogViewer
OSLogViewer is made for viewing your apps OS_Log history, it is a SwiftUI view which can be used in your app to view and export your logs.
[](https://swiftpackageindex.com/0xWDG/OSLogViewer)
[](https://swiftpackageindex.com/0xWDG/OSLogViewer)
[](https://swift.org/package-manager)

_Key features:_
- View your apps OS_Log history
- Export logs
## Requirements
- Swift 5.8+ (Xcode 14.3+)
- iOS 16+, macOS 12+, watchOS 9+, tvOS 16+, visionOS 1+
## Installation
Install using Swift Package Manager
```swift
dependencies: [
.package(url: "https://github.com/0xWDG/OSLogViewer.git", branch: "main"),
],
targets: [
.target(name: "MyTarget", dependencies: [
.product(name: "OSLogViewer", package: "OSLogViewer"),
]),
]
```
And import it:
```swift
import OSLogViewer
```
## Usage
### Quick usage
```swift
import OSLogViewer
NavigationLink {
// Default configuration
// uses your app's bundle identifier as subsystem
// and shows all logs from the last hour.
OSLogViewer()
} label: {
Text("View logs")
}
```
### Custom usage
custom subsystem
```swift
import OSLogViewer
OSLogViewer(
subsystem: "nl.wesleydegroot.exampleapp",
)
```
custom time
```swift
import OSLogViewer
OSLogViewer(
since: Date().addingTimeInterval(-7200) // 2 hours
)
```
custom subsystem and time
```swift
import OSLogViewer
OSLogViewer(
subsystem: "nl.wesleydegroot.exampleapp",
since: Date().addingTimeInterval(-7200) // 2 hours
)
```
## Screenshots

## Export example
```plaintext
This is the OSLog archive for exampleapp
Generated on 2/6/2024, 11:53
Generator https://github.com/0xWDG/OSLogViewer
Info message
โน๏ธ 2/6/2024, 11:53 ๐๏ธ exampleapp โ๏ธ nl.wesleydegroot.exampleapp ๐ myCategory
Error message
โ 2/6/2024, 11:53 ๐๏ธ exampleapp โ๏ธ nl.wesleydegroot.exampleapp ๐ myCategory
Error message
โ 2/6/2024, 11:53 ๐๏ธ exampleapp โ๏ธ nl.wesleydegroot.exampleapp ๐ myCategory
Critical message
โผ๏ธ 2/6/2024, 11:53 ๐๏ธ exampleapp โ๏ธ nl.wesleydegroot.exampleapp ๐ myCategory
Log message
๐ 2/6/2024, 11:53 ๐๏ธ exampleapp โ๏ธ nl.wesleydegroot.exampleapp ๐ myCategory
Log message
๐ 2/6/2024, 11:53 ๐๏ธ exampleapp โ๏ธ nl.wesleydegroot.exampleapp ๐ myCategory
```
## Changelog
- 1.0.0
- Initial release
- 1.0.1
- Improved support for dark mode.
- Colors are more similar to Xcode's console.
- Added support for exporting logs.
- 1.0.2 & 1.0.3
- Fix: building on macOS < 14.
- Improved support for dark mode.
- Colors are more similar to Xcode's console.
- Added support for exporting logs.
- 1.0.4
- Fix: building on all platforms other than iOS.
- Improved support for dark mode.
- Colors are more similar to Xcode's console.
- Added support for exporting logs.
- Added online documentation https://0xwdg.github.io/OSLogViewer/
- 1.0.5
- Improve text alignment and word-breaks in the details
- 1.0.7
- Multi platform support
- 1.0.8
- Fix hang on loading data
- 1.1.0
- Added OSLogExtractor
- 1.1.1
- Fixes for Linux targets
- 1.1.2
- Fix logs on Mac displaying incorrectly by @infinitepower18 in #2
- 1.1.3
- Make datarace safe
## Contact
๐ฆ [@0xWDG](https://bsky.app/profile/0xWDG.bsky.social)
๐ [mastodon.social/@0xWDG](https://mastodon.social/@0xWDG)
๐ฆ [@0xWDG](https://x.com/0xWDG)
๐งต [@0xWDG](https://www.threads.net/@0xWDG)
๐ [wesleydegroot.nl](https://wesleydegroot.nl)
๐ค [Discord](https://discordapp.com/users/918438083861573692)
Interested learning more about Swift? [Check out my blog](https://wesleydegroot.nl/blog/).