From 0945da8dfefcbb723eecea0e5f4eafff63398253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20B=C3=BCtow?= Date: Sun, 26 Jan 2020 11:26:53 +0000 Subject: Introduce drun command, refactor code to use context package --- internal/io/line/line.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 internal/io/line/line.go (limited to 'internal/io/line') diff --git a/internal/io/line/line.go b/internal/io/line/line.go new file mode 100644 index 0000000..9db93c0 --- /dev/null +++ b/internal/io/line/line.go @@ -0,0 +1,28 @@ +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 + 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) +} -- cgit v1.2.3