message

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: Apache-2.0 Imports: 2 Imported by: 32

Documentation

Index

Constants

View Source
const (
	StatusEmergency = "emergency"
	StatusAlert     = "alert"
	StatusCritical  = "critical"
	StatusError     = "error"
	StatusWarning   = "warn"
	StatusNotice    = "notice"
	StatusInfo      = "info"
	StatusDebug     = "debug"
)

Status values

Variables

View Source
var (
	SevEmergency = []byte("<40>")
	SevAlert     = []byte("<41>")
	SevCritical  = []byte("<42>")
	SevError     = []byte("<43>")
	SevWarning   = []byte("<44>")
	SevNotice    = []byte("<45>")
	SevInfo      = []byte("<46>")
	SevDebug     = []byte("<47>")
)

Syslog severity levels

Functions

func StatusToSeverity

func StatusToSeverity(status string) []byte

StatusToSeverity transforms a severity into a status.

Types

type Message

type Message struct {
	Content []byte
	Origin  *Origin
	// contains filtered or unexported fields
}

Message represents a log line sent to datadog, with its metadata

func NewMessage

func NewMessage(content []byte, origin *Origin, status string) *Message

NewMessage constructs message with full information.

func NewMessageWithSource

func NewMessageWithSource(content []byte, status string, source *config.LogSource) *Message

NewMessageWithSource constructs message with content, status and log source.

func (*Message) GetStatus

func (m *Message) GetStatus() string

GetStatus gets the status of the message. if status is not set, StatusInfo will be returned.

type Origin

type Origin struct {
	Identifier string
	LogSource  *config.LogSource
	Offset     string
	// contains filtered or unexported fields
}

Origin represents the Origin of a message

func NewOrigin

func NewOrigin(source *config.LogSource) *Origin

NewOrigin returns a new Origin

func (*Origin) Service

func (o *Origin) Service() string

Service returns the service of the configuration if set or the service of the message, if none are defined, returns an empty string by default.

func (*Origin) SetService

func (o *Origin) SetService(service string)

SetService sets the service of the origin.

func (*Origin) SetSource

func (o *Origin) SetSource(source string)

SetSource sets the source of the origin.

func (*Origin) SetTags

func (o *Origin) SetTags(tags []string)

SetTags sets the tags of the origin.

func (*Origin) Source

func (o *Origin) Source() string

Source returns the source of the configuration if set or the source of the message, if none are defined, returns an empty string by default.

func (*Origin) Tags

func (o *Origin) Tags() []string

Tags returns the tags of the origin.

func (*Origin) TagsPayload

func (o *Origin) TagsPayload() []byte

TagsPayload returns the raw tag payload of the origin.

func (*Origin) TagsToString

func (o *Origin) TagsToString() string

TagsToString encodes tags to a single string, in a comma separated format

Jump to

Keyboard shortcuts

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