summaryrefslogtreecommitdiff
path: root/internal/io/line/line.go
blob: 715be34234b6dfc97a9d3805a862672bc2ca5590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package line

import (
	"fmt"
)

// Line represents a read log line.
type Line struct {
	// The content of the log line.
	Content []byte
	// Until now, how many log lines were processed?
	Count uint64
	// Sometimes we produce too many log lines so that the client
	// is too slow to process all of them. The server will drop log
	// lines if that happens but it will signal to the client how
	// many log lines in % could be transmitted to the client.
	TransmittedPerc int
	// Contains the unique identifier of the source log file.
	// It could be the name of the log or it could be one of the parent
	// directories in case multiple log files with the same basename are
	// followed.
	SourceID string
}

// Return a human readable representation of the followed line.
func (l Line) String() string {
	return fmt.Sprintf("Line(Content:%s,TransmittedPerc:%v,Count:%v,SourceID:%s)",
		string(l.Content),
		l.TransmittedPerc,
		l.Count,
		l.SourceID)
}