Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 39 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
go-cloudlog
===

[![GoDoc](https://godoc.org/github.com/anexia-it/go-cloudlog?status.svg)](https://godoc.org/github.com/anexia-it/go-cloudlog)
[![Build Status](https://travis-ci.org/anexia-it/go-cloudlog.svg?branch=master)](https://travis-ci.org/anexia-it/go-cloudlog)
[![codecov](https://codecov.io/gh/anexia-it/go-cloudlog/branch/master/graph/badge.svg)](https://codecov.io/gh/anexia-it/go-cloudlog)
[![Go Reference](https://pkg.go.dev/badge/anexia-it/go-cloudlog?status.svg)](https://pkg.go.dev/github.com/anexia-it/go-cloudlog)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/anexia-it/go-cloudlog)](https://github.com/anexia-it/go-cloudlog/releases/latest)
[![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/anexia-it/go-cloudlog)](https://github.com/anexia-it/go-cloudlog/blob/master/go.mod)
[![Go Report Card](https://goreportcard.com/badge/github.com/anexia-it/go-cloudlog)](https://goreportcard.com/report/github.com/anexia-it/go-cloudlog)
[![GitHub license](https://img.shields.io/github/license/anexia-it/go-cloudlog)](https://github.com/anexia-it/go-cloudlog/blob/master/LICENSE)

go-cloudlog is a client library for Anexia CloudLog.

Expand All @@ -13,47 +14,49 @@ go-cloudlog is a client library for Anexia CloudLog.
With a [correctly configured](https://golang.org/doc/install#testing) Go toolchain:

```sh
go get -u github.com/anexia-it/go-cloudlog
go get -u github.com/anexia-it/go-cloudlog/v2
```

## Quickstart

```go
package main

import cloudlog "github.com/anexia-it/go-cloudlog"
import (
"github.com/anexia-it/go-cloudlog/v2"
"time"
)

func main() {

// Init CloudLog client
client, err := cloudlog.NewCloudLog("index", "token")
if err != nil {
panic(err)
}

// Push simple message
client.PushEvent("My first CloudLog event")

// Push document as map
logger.PushEvent(map[string]interface{}{
"timestamp": time.Now(),
"user": "test",
"severity": 1,
"message": "My first CloudLog event",
})

// Push document as map
type Document struct {
Timestamp uint64 `cloudlog:"timestamp"`
User string `cloudlog:"user"`
Severity int `cloudlog:"severity"`
Message string `cloudlog:"message"`
}
logger.PushEvent(&Document{
Timestamp: 1495171849463,
User: "test",
Severity: 1,
Message: "My first CloudLog event",
})
// Init CloudLog client
client, err := cloudlog.NewCloudLog("index", "token")
if err != nil {
panic(err)
}

// Push simple message
client.PushEvent("My first CloudLog event")

// Push document as map
client.PushEvent(map[string]interface{}{
"timestamp": time.Now(),
"user": "test",
"severity": 1,
"message": "My CloudLog event with a map",
})

// Push document as struct
type Document struct {
Timestamp uint64 `cloudlog:"timestamp"`
User string `cloudlog:"user"`
Severity int `cloudlog:"severity"`
Message string `cloudlog:"message"`
}
client.PushEvent(&Document{
Timestamp: 1495171849463,
User: "test",
Severity: 1,
Message: "My CloudLog event with a struct",
})
}
```