stream

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Message Flags
	StreamFlag Flag = 1 << iota
	//EOP success
	ExitSuccessFlag
	//EOP error
	ExitErrorFlag

	//LevelStdout stdout message
	LevelStdout uint16 = 1 // stdout
	//LevelStderr stderr message
	LevelStderr uint16 = 2 // stderr
	//LevelPublic public message
	LevelPublic uint16 = 3 // message for endusers / public message
	//LevelOperator operator message
	LevelOperator uint16 = 4 // message for operator / internal message
	//LevelUnknown unknown message
	LevelUnknown uint16 = 5 // log msg (unstructured = level5, cat=unknown)
	//LevelStructured structured message
	LevelStructured uint16 = 6 // log msg structured
	//LevelWarning warning message
	LevelWarning uint16 = 7 // warning message
	//LevelOpsError ops error message
	LevelOpsError uint16 = 8 // ops error
	//LevelCritical critical message
	LevelCritical uint16 = 9 // critical error
	//LevelStatsd statsd message
	LevelStatsd uint16 = 10 // statsd message(s) AVG
	//LevelDebug debug message
	LevelDebug uint16 = 11 // debug message
	//LevelResultJSON json result message
	LevelResultJSON uint16 = 20 // result message, json
	//LevelResultYAML yaml result message
	LevelResultYAML uint16 = 21 // result message, yaml
	//LevelResultTOML toml result message
	LevelResultTOML uint16 = 22 // result message, toml
	//LevelResultHRD hrd result message
	LevelResultHRD uint16 = 23 // result message, hrd
	//LevelResultJob job result message
	LevelResultJob uint16 = 30 // job, json (full result of a job)
)

Variables

Functions

func Consume added in v1.2.0

func Consume(wg *sync.WaitGroup, source io.ReadCloser, level uint16, handler MessageHandler)

Consume consumes a stream to the end, and calls the handler with the parsed stream messages

Types

type Buffer

type Buffer struct {
	*list.List
	// contains filtered or unexported fields
}

func NewBuffer

func NewBuffer(size int) *Buffer

func (*Buffer) Append

func (b *Buffer) Append(o interface{})

func (*Buffer) String

func (b *Buffer) String() string

type Flag added in v1.2.0

type Flag uint16

type Message

type Message struct {
	Message string `json:"message"`
	Epoch   int64  `json:"epoch"`
	Meta    Meta   `json:"meta"`
}

Message is a message from running process

func (*Message) String

func (msg *Message) String() string

String represents a message as a string

type MessageHandler

type MessageHandler func(*Message)

MessageHandler represents a callback type

type Meta added in v1.2.0

type Meta uint64

func NewMeta added in v1.2.0

func NewMeta(level uint16, flag ...Flag) Meta

func NewMetaWithCode added in v1.2.0

func NewMetaWithCode(code uint32, level uint16, flag ...Flag) Meta

func (Meta) Assert added in v1.2.0

func (m Meta) Assert(level ...uint16) bool

func (Meta) Base added in v1.2.0

func (m Meta) Base() Meta

Base gets meta without the code part (used for backward compatibility)

func (Meta) Code added in v1.2.0

func (m Meta) Code() uint32

Code exit code

func (Meta) Is added in v1.2.0

func (m Meta) Is(flag Flag) bool

Is checks if a flag is set on the meta object

func (Meta) Level added in v1.2.0

func (m Meta) Level() uint16

func (Meta) Set added in v1.2.0

func (m Meta) Set(flag Flag) Meta

Set sets a flag on meta object

Jump to

Keyboard shortcuts

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