timestamper

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StdoutType StreamType = 'O'
	StderrType StreamType = 'E'

	PartialLineType LineType = '+'
	FullLineType    LineType = ' '
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LineType

type LineType byte

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 for the last carriage return (\r) in calls to Write() that don't contain a new-line character. Such lines are often used to display progress bars, so having them "flushed" to the underlying stream can help with live log viewing.

func New

func New(w io.Writer, streamType StreamType, streamNumber uint8, timestamp bool) *Logger

func (*Logger) Close

func (l *Logger) Close() error

func (*Logger) Write

func (l *Logger) Write(p []byte) (n int, err error)

type StreamType

type StreamType byte

Jump to

Keyboard shortcuts

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