emitter

package
Version: v0.0.0-...-36eddf1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2017 License: Apache-2.0, BSD-3-Clause, MIT Imports: 6 Imported by: 11

README

loggregatorlib/emitter

This library is now DEPRECATED. Please use github.com/cloudfoundry/dropsonde/emitter/logemitter for new code.

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)
}

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 {
	// contains filtered or unexported fields
}

func New

func New(loggregatorServer, sourceName, sourceId, sharedSecret string, conn net.PacketConn, logger *gosteno.Logger) (*LoggregatorEmitter, error)

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)

Source Files

Directories

Path Synopsis
This file was generated by counterfeiter
This file was generated by counterfeiter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL