Skip to content

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.

License

Notifications You must be signed in to change notification settings

0xWDG/OSLogViewer

Repository files navigation

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.

Swift Package Manager License

Key features:

  • View your apps OS_Log history
  • Export logs

Requirements

  • Swift 5.9+ (Xcode 15+)
  • iOS 13+, macOS 10.15+

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 OSLogViewer

Usage

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

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 🌐 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.

Contact

We can get in touch via Twitter/X, Discord, Mastodon, Threads, Bluesky.

Alternatively you can visit my Website.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages