https://github.com/rawnly/logre-client-go
Go client for Logre
https://github.com/rawnly/logre-client-go
api client golang http log logre
Last synced: 5 months ago
JSON representation
Go client for Logre
- Host: GitHub
- URL: https://github.com/rawnly/logre-client-go
- Owner: rawnly
- Created: 2020-04-17T11:26:08.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-21T10:04:59.000Z (over 4 years ago)
- Last Synced: 2024-12-28T09:43:25.396Z (over 1 year ago)
- Topics: api, client, golang, http, log, logre
- Language: Go
- Homepage: https://logre.io
- Size: 9.77 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Logre Go Client
> [Logre][logre] client written in GoLang
This *logre* package provides a fast way to push your logs into [logre.io][logre]
> Are you a Java developer? Check out the [Java driver](https://github.com/Rawnly/logre-client-java) for Logre.IO
## Installation
```shell script
go get -u github.com/rawnly/logre-client-go
```
## Getting Started
The easiest way to log is with the `Message` or `Log` method.
```go
package main
import "github.com/rawnly/logre-client-go"
func main() {
type Payload struct {
ID uint `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
// initialize the client with your box_id
logre.Init("")
// Explicity ignoring the error
_, _ = logre.Message("Hello World!")
// You can also log a JSON
_, _ = logre.Log(Payload{ ID: 1, Name: "Rawnly" })
}
```
Since this library is just a wrapper for an API call, we'll need to handle http-errors.
## Log with Severity
You can also log with `severity` via `Info`, `Debug`, `Warning`, `Error` and `Fatal` methods
```go
package main
import "github.com/rawnly/go-logre"
func main() {
type Payload struct {
ID uint `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
// initialize the client with your box_id
logre.Init("")
// Explicity ignoring the error
_, _ = logre.DebugMessage("Hello at Debug level")
// You can also log a JSON
_, _ = logre.Debug(Payload{ ID: 1, Name: "Rawnly" })
}
```
[logre]: https://logre.io