Skip to content

Commit 0ba60ec

Browse files
author
Guilherme Souza
authored
Update README.md
1 parent 1e593cb commit 0ba60ec

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
11
# swift-log-supabase
22

3-
A description of this package.
3+
A logging backend for [apple/swift-log](https://github.com/apple/swift-log) that sends log entries to [Supabase](https://github.com/supabase/supabase).
4+
5+
## Getting Started
6+
7+
Add `swift-log-supabase` as a dependency to your project using SPM.
8+
9+
```swift
10+
.package(url: "https://github.com/binaryscraping/swift-log-supabase", from: "0.1.0"),
11+
```
12+
13+
And in your application/target, add `"SupabaseLogger"` to your `"dependencies"`.
14+
15+
```swift
16+
.target(
17+
name: "YourTarget",
18+
dependencies: [
19+
.product(name: "SupabaseLogger", package: "swift-log-supabase"),
20+
]
21+
)
22+
```
23+
24+
## Usage
25+
26+
Start by creating the logs table on Supabase dashboard by running the [supabase-init.sql](/supabase-init.sql) script on Supabase SQL Editor.
27+
28+
During app startup/initialization.
29+
30+
```swift
31+
import Logging
32+
import SupabaseLogging
33+
34+
LoggingSystem.bootstrap { label in
35+
SupabaseLogHandler(
36+
label: label,
37+
config: SupabaseLogConfig(
38+
table: "logs", // optional table name to use, defaults to "logs".
39+
supabaseURL: "https://your-supabase-project-url.com/rest/v1",
40+
supabaseAnonKey: "your-supabase-anon-key",
41+
isDebug: true // optional flag to turn on/off internal logging, defaults to "false".
42+
)
43+
)
44+
}
45+
46+
let logger = Logger(label: "co.binaryscraping.swift-log-supabase")
47+
logger.info("Supabase is super cool")
48+
```
49+
50+
For more details on all the features of the Swift Logging API, check out the [swift-log](https://github.com/apple/swift-log) repo.

0 commit comments

Comments
 (0)