OSLogViewer

1.0.5

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.
0xWDG/OSLogViewer

What's New

1.0.5

2024-06-06T19:17:30Z

Improve text alignment and word-breaks in the details

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.

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

Last updated: Fri Nov 29 2024 12:45:21 GMT-1000 (Hawaii-Aleutian Standard Time)