https://github.com/binaryscraping/swift-log-supabase
A logging backend for apple/swift-log that sends log entries to Supabase.
https://github.com/binaryscraping/swift-log-supabase
logging supabase swift-log
Last synced: 3 months ago
JSON representation
A logging backend for apple/swift-log that sends log entries to Supabase.
- Host: GitHub
- URL: https://github.com/binaryscraping/swift-log-supabase
- Owner: binaryscraping
- Created: 2022-04-08T14:26:47.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-10T12:50:31.000Z (almost 3 years ago)
- Last Synced: 2025-01-31T16:01:47.256Z (3 months ago)
- Topics: logging, supabase, swift-log
- Language: Swift
- Homepage:
- Size: 22.5 KB
- Stars: 9
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# swift-log-supabase
A logging backend for [apple/swift-log](https://github.com/apple/swift-log) that sends log entries to [Supabase](https://github.com/supabase/supabase).
## Getting Started
Add `swift-log-supabase` as a dependency to your project using SPM.
```swift
.package(url: "https://github.com/binaryscraping/swift-log-supabase", from: "0.1.0"),
```And in your application/target, add `"SupabaseLogging"` to your `"dependencies"`.
```swift
.target(
name: "YourTarget",
dependencies: [
.product(name: "SupabaseLogging", package: "swift-log-supabase"),
]
)
```## Usage
Start by creating the logs table on Supabase dashboard by running the [supabase-init.sql](/supabase-init.sql) script on Supabase SQL Editor.
```swift
import Logging
import SupabaseLogging// During app startup/initialization.
LoggingSystem.bootstrap { label in
SupabaseLogHandler(
label: label,
config: SupabaseLogConfig(
table: "logs", // optional table name to use, defaults to "logs".
supabaseURL: "https://your-supabase-project-url.com/rest/v1",
supabaseAnonKey: "your-supabase-anon-key",
isDebug: true // optional flag to turn on/off internal logging, defaults to "false".
)
)
}// Then just log it.
let logger = Logger(label: "co.binaryscraping.swift-log-supabase")
logger.info("Supabase is super cool")
```For more details on all the features of the Swift Logging API, check out the [swift-log](https://github.com/apple/swift-log) repo.