loggly

package
v0.0.0-...-fd97e0e Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2016 License: Apache-2.0 Imports: 11 Imported by: 0

README

go-loggly

Loggly client for Go.

View the docs.

Installation

$ go get github.com/segmentio/go-loggly

Debug

Enable verbose debugging output using the DEBUG environment variable, for exmaple DEBUG=loggly.

License

MIT

Documentation

Index

Constants

View Source
const Version = "0.4.3"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Optionally output logs to the given writer.
	Writer io.Writer

	// Log level defaulting to INFO.
	Level Level

	// Size of buffer before flushing [100]
	BufferSize int

	// Flush interval regardless of size [5s]
	FlushInterval time.Duration

	// Loggly end-point.
	Endpoint string

	// Token string.
	Token string

	// Default properties.
	Defaults Message

	sync.Mutex
	// contains filtered or unexported fields
}

Loggly client.

func New

func New(token string, tags ...string) *Client

New returns a new loggly client with the given `token`. Optionally pass `tags` or set them later with `.Tag()`.

func (*Client) Alert

func (c *Client) Alert(t string, props ...Message) error

Alert log.

func (*Client) Critical

func (c *Client) Critical(t string, props ...Message) error

Critical log.

func (*Client) Debug

func (c *Client) Debug(t string, props ...Message) error

Debug log.

func (*Client) Emergency

func (c *Client) Emergency(t string, props ...Message) error

Emergency log.

func (*Client) Error

func (c *Client) Error(t string, props ...Message) error

Error log.

func (*Client) Flush

func (c *Client) Flush() error

Flush the buffered messages.

func (*Client) Info

func (c *Client) Info(t string, props ...Message) error

Info log.

func (*Client) Notice

func (c *Client) Notice(t string, props ...Message) error

Notice log.

func (*Client) Send

func (c *Client) Send(msg Message) error

Send buffers `msg` for async sending.

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(newClient *http.Client)

SetHTTPClient sets the HTTP client the loggly client is going to use to connect to the loggly API.

func (*Client) Tag

func (c *Client) Tag(tags ...string)

Tag adds the given `tags` for all logs.

func (*Client) Warn

func (c *Client) Warn(t string, props ...Message) error

Warning log.

func (*Client) Write

func (c *Client) Write(b []byte) (int, error)

Write raw data to loggly.

type Level

type Level int
const (
	DEBUG Level = iota
	INFO
	NOTICE
	WARNING
	ERROR
	CRITICAL
	ALERT
	EMERGENCY
)

type Message

type Message map[string]interface{}

Jump to

Keyboard shortcuts

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