Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bruno-garcia/sentrycocoalumberjack
CocoaLumberjack integration for Sentry
https://github.com/bruno-garcia/sentrycocoalumberjack
cocoalumberjack logging sentry
Last synced: about 2 months ago
JSON representation
CocoaLumberjack integration for Sentry
- Host: GitHub
- URL: https://github.com/bruno-garcia/sentrycocoalumberjack
- Owner: bruno-garcia
- License: mit
- Created: 2020-09-05T21:07:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-09-06T21:24:07.000Z (over 4 years ago)
- Last Synced: 2024-12-13T02:30:20.581Z (about 2 months ago)
- Topics: cocoalumberjack, logging, sentry
- Language: Swift
- Homepage:
- Size: 4.77 MB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# SentryCocoaLumberjack
[![build](https://github.com/bruno-garcia/SentryCocoaLumberjack/workflows/build/badge.svg?branch=main)](https://github.com/bruno-garcia/SentryCocoaLumberjack/actions?query=branch%3Amain)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fbruno-garcia%2FSentryCocoaLumberjack%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/bruno-garcia/SentryCocoaLumberjack)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fbruno-garcia%2FSentryCocoaLumberjack%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/bruno-garcia/SentryCocoaLumberjack)Send your [`CocoaLumberjack`](https://github.com/CocoaLumberjack/CocoaLumberjack) log messages to [Sentry](https://sentry.io).
## Using this library
Install it with Swift Package Manager
```swift
.package(url: "https://github.com/bruno-garcia/SentryCocoaLumberjack", from: "0.0.1-alpha.2")
```Add the Sentry logger to your app:
```swift
let sentryLogger = SentryLogger()
DDLog.add(sentryLogger, with: DDLogLevel.info)
```Done. All log messages with level `info` or higher will be stored as breadcrumbs.
Logs with level `error` send an event to Sentry, which include the breadcrumbs.These log levels can be configured. Check out the [example console app in this repo](Example/main.swift).
## A low quality `gif` to give you an idea
![Running the example](.github/sentry-cocoalumberjack.gif)
## Run the example
First add your DSN to [Example/main.swift](Example/main.swift).
Run it:
```sh
swift run2020-09-05 20:39:59:741 Example[74424:4634517] 🔊 Noise message again: Something trivial.
2020-09-05 20:39:59:741 Example[74424:4634517] 🌍 Check this out, something's weird.
2020-09-05 20:39:59:741 Example[74424:4634517] 🪓🌴 Something relevant happened. Be aware.
2020-09-05 20:39:59:741 Example[74424:4634517] 🍁 Warning! This isn't good.
2020-09-05 20:39:59:741 Example[74424:4634517] 🔥 Broken stuff! Please fix this!
```The example is configured with custom minimum levels so you can see `info`, `warning` and `error` level events sent to Sentry.
All levels are stored as breadcrumbs.