AreroKetahi/swift-log-data
A swift-log backend which using SwiftData to store log.
Quick Start - SwiftUI
- Register the model container in the scene that you may logging.
Here is an example that regsiter the model in to the main scene.
```swift import DataLogger
@main struct Example_App: App { var body: some Scene { WindowGroup { ContentView() } .logContainer() } } ```
- Bootstrap the logger.
``swift import Logging // Initializer in Example_App init() { LoggingSystem.bootstrap(DataLogger.init) } ``
- Use the swift-log API for logging. For more details, please check swift-log Github Repo.
Read the logs
If you are using SwiftUI, you can use environmental logActor to access the logging actor.
@Environment(\.logActor) var logActor
func getLogs() async throws -> [Log] {
try await logActor.fetch()
}The model store of logs stored in /Container/Library/Logs
Package Metadata
Repository: AreroKetahi/swift-log-data
Stars: 0
Forks: 0
Open issues: 0
Default branch: main
Primary language: swift
Topics: logging, swift, swift-6, swift-log, swift-package, swiftui
README: README.md