Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/meinside/loggly-go

A Go library for Loggly
https://github.com/meinside/loggly-go

golang loggly

Last synced: about 2 months ago
JSON representation

A Go library for Loggly

Awesome Lists containing this project

README

        

# loggly-go

A Go library for [Loggly](https://www.loggly.com/).

## How to get it

```bash
$ go get github.com/meinside/loggly-go
```

## How to use it

```go
// sample.go
package main

import (
"time"

"github.com/meinside/loggly-go"
)

func main() {
logger := loggly.New("XXXXXX-0000-YYYY-ZZZZ-0000000000000")

time.Sleep(1 * time.Second) // wait for the logger getting ready

// can log any type of variable
logger.Log("Hello loggly.") // a string,
for i := 0; i < 42; i++ {
logger.Log(i) // a number,
}
logger.Log(struct {
Severity string `json:"severity"`
Message string `json:"message"`
}{
Severity: "WARN",
Message: "This is a warning.",
}) // or even a struct

// XXX - wait until all logs are transfered
time.Sleep(40 * time.Second)
}
```

## License

MIT