OSLogViewer 用于查看您的应用程序的 OS_Log 历史记录。它是一个 SwiftUI 视图,可以在您的应用程序中使用,以查看和导出您的日志。
主要特性
使用 Swift Package Manager 安装
dependencies: [
.package(url: "https://github.com/0xWDG/OSLogViewer.git", branch: "main"),
],
targets: [
.target(name: "MyTarget", dependencies: [
.product(name: "OSLogViewer", package: "OSLogViewer"),
]),
]
并导入它
import OSLogViewer
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")
}
自定义子系统
import OSLogViewer
OSLogViewer(
subsystem: "nl.wesleydegroot.exampleapp",
)
自定义时间
import OSLogViewer
OSLogViewer(
since: Date().addingTimeInterval(-7200) // 2 hours
)
自定义子系统和时间
import OSLogViewer
OSLogViewer(
subsystem: "nl.wesleydegroot.exampleapp",
since: Date().addingTimeInterval(-7200) // 2 hours
)
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
🦋 @0xWDG 🐘 mastodon.social/@0xWDG 🐦 @0xWDG 🧵 @0xWDG 🌐 wesleydegroot.nl 🤖 Discord
有兴趣了解更多关于 Swift 的信息吗? 查看我的博客。