Documentation ¶
Index ¶
- Variables
- type Decoder
- type DockerUnwrapper
- type Input
- type LineBuffer
- func (l *LineBuffer) Add(line []byte)
- func (l *LineBuffer) AddEndOfLine()
- func (l *LineBuffer) AddIncompleteLine(line []byte)
- func (l *LineBuffer) AddTruncate(line []byte)
- func (l *LineBuffer) Content() ([]byte, int)
- func (l *LineBuffer) IsEmpty() bool
- func (l *LineBuffer) Length() int
- func (l *LineBuffer) Reset()
- type LineHandler
- type LineUnwrapper
- type MultiLineHandler
- type Output
- type SingleLineHandler
Constants ¶
This section is empty.
Variables ¶
var TRUNCATED = []byte("...TRUNCATED...")
TRUNCATED is the warning we add at the beginning or/and at the end of a truncated message
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct { InputChan chan *Input OutputChan chan *Output // contains filtered or unexported fields }
Decoder splits raw data into lines and passes them to a lineHandler that emits outputs
func InitializeDecoder ¶
InitializeDecoder returns a properly initialized Decoder
type DockerUnwrapper ¶
type DockerUnwrapper struct{}
DockerUnwrapper removes all the information added by docker to logs coming from containers
func NewDockerUnwrapper ¶
func NewDockerUnwrapper() *DockerUnwrapper
NewDockerUnwrapper returns a new DockerUnwrapper
func (DockerUnwrapper) Unwrap ¶
func (u DockerUnwrapper) Unwrap(line []byte) []byte
Unwrap removes the message header of docker logs
type Input ¶
type Input struct {
// contains filtered or unexported fields
}
Input represents a list of bytes consumed by the Decoder
type LineBuffer ¶
type LineBuffer struct {
// contains filtered or unexported fields
}
LineBuffer accumulates lines in buffer escaping all '\n' and accumulates the total number of bytes of all lines in line representation (line + '\n') in rawDataLen
func (*LineBuffer) AddEndOfLine ¶
func (l *LineBuffer) AddEndOfLine()
AddEndOfLine stores an escaped '\n' in buffer
func (*LineBuffer) AddIncompleteLine ¶
func (l *LineBuffer) AddIncompleteLine(line []byte)
AddIncompleteLine stores a chunck of line in buff
func (*LineBuffer) AddTruncate ¶
func (l *LineBuffer) AddTruncate(line []byte)
AddTruncate stores TRUNCATED in buffer
func (*LineBuffer) Content ¶
func (l *LineBuffer) Content() ([]byte, int)
Content returns the content in buffer and the length of the data that enabled to compute this content
func (*LineBuffer) IsEmpty ¶
func (l *LineBuffer) IsEmpty() bool
IsEmpty returns true if buffer does not contain any line
func (*LineBuffer) Length ¶
func (l *LineBuffer) Length() int
Length returns the length of buffer which might be different from rawDataLen because of escaped '\n'
type LineHandler ¶
type LineHandler interface { Handle(content []byte) Start() Stop() }
LineHandler handles byte slices to form line output
type LineUnwrapper ¶
LineUnwrapper removes all the extra information that were added to the original log
func NewUnwrapper ¶
func NewUnwrapper() LineUnwrapper
NewUnwrapper returns a default LineUnwrapper that does nothing
type MultiLineHandler ¶
type MultiLineHandler struct {
// contains filtered or unexported fields
}
MultiLineHandler reads lines from lineChan and uses lineBuffer to send them when a new line matches with re or flushTimer is fired
func NewMultiLineHandler ¶
func NewMultiLineHandler(outputChan chan *Output, newContentRe *regexp.Regexp, flushTimeout time.Duration, lineUnwrapper LineUnwrapper) *MultiLineHandler
NewMultiLineHandler returns a new MultiLineHandler
func (*MultiLineHandler) Handle ¶
func (h *MultiLineHandler) Handle(content []byte)
Handle forward lines to lineChan to process them
func (*MultiLineHandler) Stop ¶
func (h *MultiLineHandler) Stop()
Stop stops the lineHandler from processing lines
type SingleLineHandler ¶
type SingleLineHandler struct {
// contains filtered or unexported fields
}
SingleLineHandler creates and forward outputs to outputChan from single-lines
func NewSingleLineHandler ¶
func NewSingleLineHandler(outputChan chan *Output) *SingleLineHandler
NewSingleLineHandler returns a new SingleLineHandler
func (*SingleLineHandler) Handle ¶
func (h *SingleLineHandler) Handle(content []byte)
Handle trims leading and trailing whitespaces from content, and sends it as a new Line to lineChan.
func (*SingleLineHandler) Stop ¶
func (h *SingleLineHandler) Stop()
Stop stops the handler from processing new lines