kitz

package module
v0.0.0-...-71ac576 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2018 License: Apache-2.0 Imports: 3 Imported by: 3

README

Logzio for go-kit logger

Send go-kit logs to Logzio

Build Status Go Report Card GoDoc license

Getting Started

Get Logzio token
  1. Go to Logzio website
  2. Sign in with your Logzio account
  3. Click the top menu gear icon (Account)
  4. The Logzio token is given in the account page
Initialize Logger
package main

import (
        "github.com/dougEfresh/kitz"
        "github.com/go-kit/kit/log"
)

func main() {
        klogger, err := kitz.New("123456789")
        if err != nil {
                panic(err)
        }
        // returns the go-kit logger
        logger := klogger.Build()
        // message is required
        logger.Log("message", "hello!")
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorInvalidToken = errors.New("Invalid token")

ErrorInvalidToken Error for tokens

Functions

This section is empty.

Types

type ClientOptionFunc

type ClientOptionFunc func(*Logger) error

ClientOptionFunc to set options

func SetTimestamp

func SetTimestamp(ts log.Valuer) ClientOptionFunc

SetTimestamp overrides DefaultTimestampUTC

func SetUrl

func SetUrl(url string) ClientOptionFunc

SetUrl overrides default endpoint

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger structure

func New

func New(token string, options ...ClientOptionFunc) (*Logger, error)

New Creates a new kitz logger with DefaultTimestampUTC

l, err := kitz.New("api-key")

func (*Logger) Drain

func (l *Logger) Drain()

func (*Logger) Log

func (l *Logger) Log(keyvals ...interface{}) error

Log Statisfies go-kit log interface

func (*Logger) Stop

func (l *Logger) Stop()

Stop the logger and drain local values to Logz.io

func (*Logger) Write

func (l *Logger) Write(p []byte) (n int, err error)

Write Statisfies go-kit log interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL