emitter

package
v0.0.0-...-eb0d769 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2014 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 6 Imported by: 0

README

loggregatorlib/emitter

This is a GO library to emit messages to the loggregator.

Create an emitter with NewLogMessageEmitter with the loggregator trafficcontroller hostname and port, a source name, the loggregator shared secret, and a gosteno logger.

Call Emit on the emitter with the application GUID and message strings.

A valid source name is any 3 character string. Some common component sources are:
API (Cloud Controller)
RTR (Go Router)
UAA
DEA
APP (Warden container)
LGR (Loggregator)

###Sample Workflow

import "github.com/cloudfoundry/loggregatorlib/emitter"

func main() {
    appGuid := "a8977cb6-3365-4be1-907e-0c878b3a4c6b" // The GUID(UUID) for the user's application
    emitter, err := emitter.NewLogMessageEmitter("10.10.10.16:38452", "RTR", "shared secret", gosteno.NewLogger("LoggregatorEmitter"))
    emitter.Emit(appGuid, message)
}

###TODO

  • All messages are annotated with a message type of OUT. At this time, we don't support emitting messages with a message type of ERR.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MAX_MESSAGE_BYTE_SIZE = (9 * 1024) - 512
	TRUNCATED_BYTES       = []byte("TRUNCATED")
	TRUNCATED_OFFSET      = MAX_MESSAGE_BYTE_SIZE - len(TRUNCATED_BYTES)
)

Functions

This section is empty.

Types

type Emitter

type Emitter interface {
	Emit(string, string)
	EmitError(string, string)
	EmitLogMessage(*logmessage.LogMessage)
}

type LoggregatorEmitter

type LoggregatorEmitter struct {
	LoggregatorClient loggregatorclient.LoggregatorClient
	// contains filtered or unexported fields
}

func NewEmitter

func NewEmitter(loggregatorServer, sourceName, sourceId, sharedSecret string, logger *gosteno.Logger) (*LoggregatorEmitter, error)

func (*LoggregatorEmitter) Emit

func (e *LoggregatorEmitter) Emit(appid, message string)

func (*LoggregatorEmitter) EmitError

func (e *LoggregatorEmitter) EmitError(appid, message string)

func (*LoggregatorEmitter) EmitLogMessage

func (e *LoggregatorEmitter) EmitLogMessage(logMessage *logmessage.LogMessage)

Jump to

Keyboard shortcuts

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