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.
Requirements
- Swift 5.8+ (Xcode 14.3+)
- iOS 16+, macOS 12+, watchOS 9+, tvOS 16+, visionOS 1+
Installation
Install using Swift Package Manager
dependencies: [
.package(url: "https://github.com/0xWDG/OSLogViewer.git", branch: "main"),
],
targets: [
.target(name: "MyTarget", dependencies: [
.product(name: "OSLogViewer", package: "OSLogViewer"),
]),
]And import it:
import OSLogViewerUsage
Quick usage
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
import OSLogViewer
OSLogViewer(
subsystem: "nl.wesleydegroot.exampleapp",
)custom time
import OSLogViewer
OSLogViewer(
since: Date().addingTimeInterval(-7200) // 2 hours
)custom subsystem and time
import OSLogViewer
OSLogViewer(
subsystem: "nl.wesleydegroot.exampleapp",
since: Date().addingTimeInterval(-7200) // 2 hours
)Screenshots
<img src='https://github.com/0xWDG/OSLogViewer/assets/1290461/c2f870b5-cb7c-42f0-bdfd-78b88b73bb3a' height='500'>
Export example
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 π myCategoryChangelog
- 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 π mastodon.social/@0xWDG π¦ @0xWDG π§΅ @0xWDG π wesleydegroot.nl π€ Discord
Interested learning more about Swift? Check out my blog.
Package Metadata
Repository: 0xWDG/OSLogViewer
Homepage: https://0xwdg.github.io/OSLogViewer/
Stars: 25
Forks: 3
Open issues: 0
Default branch: main
Primary language: swift
License: MIT
Topics: 0xwdg, hacktoberfest, logger, oslog, oslogviewer, spm, swift, swift-lang, swiftui
README: README.md