logservice

package
v0.0.0-...-678bb0e Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package logservice provides loggers which can be used to to collect and send batches of logs to the eventlog service.

Package logservice provides a client which can be used to to collect and send batches of logs to the eventlog service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldRetry

func ShouldRetry(err error) bool

ShouldRetry reports whether a LogSync call (which returned err) should be retried.

Types

type BatchLogger

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

BatchLogger accumlates log events and sends them in batches. It is safe for concurrent use.

func NewBatchLogger

func NewBatchLogger(ctx context.Context, logger *Logger, uploadTicker <-chan time.Time) *BatchLogger

NewBatchLogger constructs a new BatchLogger. The supplied context will be used when logging entries supplied via the Log method. Its Close method must be called when it is no longer needed.

func (*BatchLogger) Close

func (bl *BatchLogger) Close()

Close flushes any pending logs and releases any resources held by the logger. Once Close has been returned, no more retry attempts will be made. Close should be called when the logger is no longer needed.

func (*BatchLogger) Log

func (bl *BatchLogger) Log(events ...*logpb.LogRequestLite_LogEventLite)

Log stages events to be logged to the eventlog service. The EventTime in each event must have been obtained from time.Now. Log returns immediately, and batches of events will be sent to the eventlog server periodically.

type Logger

type Logger struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Logger sends event logs to the eventlog service.

func NewLogger

func NewLogger(serverAddr, logSourceName string) *Logger

NewLogger constructs a new Client. Users must call Close when the Client is no longer needed.

func (*Logger) LogSync

func (l *Logger) LogSync(ctx context.Context, events ...*logpb.LogRequestLite_LogEventLite) error

LogSync synchronously logs events to the eventlog service. The EventTime in each event must have been obtained from time.Now. The returned error can be supplied to ShouldRetry to determine whether the operation should be retried.

Jump to

Keyboard shortcuts

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