Documentation
¶
Overview ¶
DataFrame wraps the byte framing used by docker to multiplex output from a docker container when there is no TTY in use. Although docker provides some functions to work with this stream, we want to keep our data in this form as long as possible, as well as making it implementable by other executors.
Docker documents this as:
[8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}[]byte{OUTPUT}
STREAM_TYPE can be 1 for stdout and 2 for stderr
SIZE1, SIZE2, SIZE3, and SIZE4 are four bytes of uint32 encoded as big endian. This is the size of OUTPUT.
Index ¶
- func ConfigureLogging(mode LogMode)
- func ConfigureTestLogging(t tTesting)
- func ContextWithNodeIDLogger(ctx context.Context, nodeID string) context.Context
- func ErrOrDebug(err error) zerolog.Level
- func LogBufferedLogs(writer io.Writer)
- func LogStream(ctx context.Context, r io.Reader)
- func ToSliceStringer[T any](ts []T, f func(t T) string) []fmt.Stringer
- func ToStringer[T any](t T, f func(t T) string) fmt.Stringer
- type DataFrame
- type LogMode
- type StreamTag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureLogging ¶
func ConfigureLogging(mode LogMode)
func ConfigureTestLogging ¶
func ConfigureTestLogging(t tTesting)
ConfigureTestLogging allows logs to be associated with individual tests
func ContextWithNodeIDLogger ¶
func ContextWithNodeIDLogger(ctx context.Context, nodeID string) context.Context
ContextWithNodeIDLogger will return a context with nodeID is added to the logging context.
func ErrOrDebug ¶ added in v0.3.29
func ErrOrDebug(err error) zerolog.Level
func LogBufferedLogs ¶
func LogBufferedLogs(writer io.Writer)
LogBufferedLogs will log any log messages written from before logging was configured to the given writer. If writer is nil, then the default logging will be used instead. This function will do nothing once the buffer has been outputted.
func ToSliceStringer ¶ added in v0.3.24
func ToSliceStringer[T any](ts []T, f func(t T) string) []fmt.Stringer
func ToStringer ¶ added in v0.3.24
func ToStringer[T any](t T, f func(t T) string) fmt.Stringer
Types ¶
type DataFrame ¶ added in v0.3.29
type DataFrame struct {
Tag StreamTag
Size int
Data []byte
}
var EmptyDataFrame DataFrame
func NewDataFrameFromData ¶ added in v0.3.29
func NewDataFrameFromData(tag StreamTag, data []byte) DataFrame
NewDataFrameFromBytes will compose a new data frame wrapping the provided tag and data with the necessary structure.
func NewDataFrameFromReader ¶ added in v0.3.29
func NewDataFrameFromReader(reader io.Reader) (DataFrame, error)
type LogMode ¶
type LogMode string
const (
LogModeDefault LogMode = "default"
LogModeStation LogMode = "station"
LogModeJSON LogMode = "json"
LogModeCombined LogMode = "combined"
LogModeEvent LogMode = "event"
)
Available logging modes
func ParseLogMode ¶
func ParseLogMode(s string) (LogMode, error)