emitter

package
v0.0.0-...-5115dcd Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: Apache-2.0, BSD-3-Clause, MIT Imports: 6 Imported by: 12 modules, 13 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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)

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
y or Y : Canonical URL