https://github.com/iadvize/swift-graylog
Graylog library written in Swift.
https://github.com/iadvize/swift-graylog
graylog ios library logger logs swift
Last synced: 11 months ago
JSON representation
Graylog library written in Swift.
- Host: GitHub
- URL: https://github.com/iadvize/swift-graylog
- Owner: iadvize
- License: mit
- Created: 2018-11-14T07:16:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T09:52:37.000Z (over 6 years ago)
- Last Synced: 2024-09-17T18:52:48.266Z (almost 2 years ago)
- Topics: graylog, ios, library, logger, logs, swift
- Language: Swift
- Size: 29 MB
- Stars: 10
- Watchers: 23
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](https://circleci.com/gh/iadvize/swift-graylog)
# SwiftGraylog
Graylog library written in Swift.
## Compatibility
| Version | Minimum iOS Version | Swift Version |
| :----------: | :-----------------: | :-----------: |
| 1.1.0, 1.1.1 | iOS 8.0 | Swift 5 |
| 1.0.0 | iOS 8.0 | Swift 4 |
## Documentation
First you have to define your Graylog server URL:
```swift
if let url = URL(string: "https://yourgraylog.com/gelf") {
Graylog.setURL(url)
}
```
Then you can send log to Graylog using the `log` method by passing a dictionary which represents your JSON payload:
```swift
Graylog.log(["message": "Hello Graylog!"])
```
Here is a list of available fields in Graylog: [Graylog Documentation](http://docs.graylog.org/en/2.4/pages/gelf.html)
If an issue is thrown while sending a log, a message will be printed in the Xcode console. The framework stores logs locally in the user preferences and retry the failed one each 60 seconds.
## Installation
### Cocoapods
Add the dependency to your Podfile:
```
pod 'SwiftGraylog'
```
and use `import SwiftGraylog` where you want to use it.
## Contribute
Look at contribution guidelines here: [CONTRIBUTING.md](CONTRIBUTING.md)
Once you've forked the repository you should `pod install` at the root of the repository and open the `SwiftGraylog.xcworkspace` workspace.
N.B. You have access to template files for Pull Requests and Issues opening:
- [ISSUE_TEMPLATE.md](ISSUE_TEMPLATE.md)
- [PULL_REQUEST_TEMPLATE.md](PULL_REQUEST_TEMPLATE.md)