Documentation
¶
Index ¶
Constants ¶
const ( StdoutType StreamType = 'O' StderrType StreamType = 'E' PartialLineType LineType = '+' FullLineType LineType = ' ' )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger implements the standard io.Write interface and adds lightweight metadata in the form of: <date> <stream id><stream type><append flag><message>
Where: - <date> is a RFC3339 Nano formatted date - <stream id> is a 2-digit hex encoded user provided stream identifier - <stream type> is either 'stdout' or 'stderr' - <append flag> is either ' ' (no-op) or '+' (append line to last line) - <message> is a user provided message.
This format is intended to be well suited to CI/CD logs, where timed output can help determine the duration of executed commands.
A new log line is emitted for each new-line character (\n) found within data provided to Write().
A new log line is also emitted when a call to Write() contains a carriage return (\r) but no new-line character. Such writes are often used to display progress bars, so having them "flushed" to the underlying stream helps with live log viewing. The whole Write() — including any bytes after the last \r — goes into a single entry; the \r is treated as a flush hint, not a content boundary. Splitting at the \r would strand the trailing bytes (e.g. a `\x1b[0K` erase-line code paired with a section marker) in the buffer until the next write on this stream, attaching them to that later entry with a stale timestamp.
type StreamType ¶
type StreamType byte