wasmlogs

package
v1.5.0-alpha13 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogMessageHeaderLength    = 17
	LogMessageStreamOffset    = 4
	LogMessageTimestampOffset = 5
	LogMessageDataSizeOffset  = 13
)
View Source
const (
	DefaultBufferChannelLen = 4096
)
View Source
const (
	DefaultFilePerms = 0755
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LogManager

type LogManager struct {
	// contains filtered or unexported fields
}

func NewLogManager

func NewLogManager(ctx context.Context, executionID string) (*LogManager, error)

func (*LogManager) Close

func (lm *LogManager) Close()

func (*LogManager) Drain

func (lm *LogManager) Drain()

func (*LogManager) GetDefaultReaders

func (lm *LogManager) GetDefaultReaders(follow bool) (io.Reader, io.Reader)

func (*LogManager) GetMuxedReader

func (lm *LogManager) GetMuxedReader(follow bool) io.ReadCloser

func (*LogManager) GetWriters

func (lm *LogManager) GetWriters() (io.WriteCloser, io.WriteCloser)

type LogMessage

type LogMessage struct {
	Stream    LogStreamType `json:"s"`
	Data      []byte        `json:"d"`
	Timestamp int64         `json:"t"`
}

func (*LogMessage) FromReader

func (m *LogMessage) FromReader(reader bufio.Reader) error

func (*LogMessage) ToBytes

func (m *LogMessage) ToBytes() []byte

ToBytes will convert the current LogMessage into a byte array which can be written to disk and reconstituted by FromBytes.

The first 4 bytes are the size of the entire LogMessage The next byte is O for stdout, E for stderr. The next 8bytes are the timestamp The next 4 bytes (n) are the size of the data Then the remaining n bytes are the data

type LogMessageTransformer

type LogMessageTransformer func(*LogMessage) []byte

type LogReader

type LogReader struct {
	// contains filtered or unexported fields
}

func NewLogReader

func NewLogReader(options LogReaderOptions) *LogReader

func (*LogReader) Close

func (r *LogReader) Close() error

func (*LogReader) Read

func (r *LogReader) Read(b []byte) (int, error)

type LogReaderOptions

type LogReaderOptions struct {
	// contains filtered or unexported fields
}

type LogStreamType

type LogStreamType int8
const (
	LogStreamStdout LogStreamType = 1
	LogStreamStderr LogStreamType = 2
)

type LogWriter

type LogWriter struct {
	// contains filtered or unexported fields
}

func NewLogWriter

func NewLogWriter(
	buffer *generic.RingBuffer[*LogMessage],
	transformer LogWriterTransform,
) *LogWriter

func (*LogWriter) Close

func (w *LogWriter) Close() error

func (*LogWriter) Write

func (w *LogWriter) Write(b []byte) (int, error)

type LogWriterTransform

type LogWriterTransform func([]byte) *LogMessage

Jump to

Keyboard shortcuts

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