Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericlewis/swift-log-sentry
Sentry logging backend for SwiftLog
https://github.com/ericlewis/swift-log-sentry
ios logging sentry swift swift-log swift-package-manager
Last synced: 3 months ago
JSON representation
Sentry logging backend for SwiftLog
- Host: GitHub
- URL: https://github.com/ericlewis/swift-log-sentry
- Owner: ericlewis
- License: mit
- Created: 2022-01-15T08:05:10.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-19T03:08:30.000Z (over 1 year ago)
- Last Synced: 2024-09-16T17:02:56.644Z (4 months ago)
- Topics: ios, logging, sentry, swift, swift-log, swift-package-manager
- Language: Swift
- Homepage:
- Size: 15.6 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SwiftLogSentry
[![Build & Test](https://github.com/ericlewis/swift-log-sentry/actions/workflows/ci.yml/badge.svg)](https://github.com/ericlewis/swift-log-sentry/actions/workflows/ci.yml)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fericlewis%2Fswift-log-sentry%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/ericlewis/swift-log-sentry)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fericlewis%2Fswift-log-sentry%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/ericlewis/swift-log-sentry)A [Sentry](https://sentry.com) logging backend for [SwiftLog](https://github.com/apple/swift-log),
it works by creating and adding a [Breadcrumb](https://docs.sentry.io/platforms/apple/guides/ios/enriching-events/breadcrumbs/) for log events.## Features
- Supports [metadata](https://github.com/apple/swift-log#logging-metadata) by inserting the key value pairs in the data property on a Breadcrumb.
- Log levels roughly map with minor differences.
- Supports line, file, and function reporting via the data property.
- 100% test coverage.## Getting started
Before using the logger you need to initialize the Sentry SDK.
#### Adding the dependency
`SwiftLogSentry` is designed for Swift 5. To use the handler, you need to declare your dependency in your `Package.swift`:
```swift
.package(url: "https://github.com/ericlewis/swift-log-sentry.git", from: "0.1.0"),
```and to your application/library target, add `"SentryLogHandler"` to your `dependencies`, e.g. like this:
```swift
.target(name: "BestExampleApp", dependencies: [
.product(name: "SentryLogHandler", package: "swift-log-sentry")
],
```## License
This library is released under the MIT license. See [LICENSE](LICENSE.md) for details.