output

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int64ToUint64 added in v0.4.0

func Int64ToUint64(nanos int64) uint64

Int64ToUint64 safely converts an int64 timestamp to uint64. UnixNano() returns int64 but OTLP protobuf requires uint64. Since timestamps are always non-negative (nanoseconds since Unix epoch), this conversion is safe. However, we validate to satisfy static analysis tools.

func TimeToUnixNanoUint64 added in v0.4.0

func TimeToUnixNanoUint64(t time.Time) uint64

TimeToUnixNanoUint64 converts a time.Time to uint64 nanoseconds. This is a convenience wrapper around Int64ToUint64 for better readability.

Types

type LogRecord added in v0.3.0

type LogRecord struct {
	// Message is the raw log message
	Message string

	// ParseFunc is an optional function that will be
	// used by some outputs to parse the message to a
	// map[string]any structure.
	ParseFunc func(message string) (map[string]any, error)

	// Metadata is the metadata for a log record.
	Metadata LogRecordMetadata
}

type LogRecordMetadata added in v0.3.0

type LogRecordMetadata struct {
	Timestamp time.Time
	Severity  string
}

LogRecordMetadata is the metadata for a log record.

type Output

type Output interface {
	Writer

	// Stop stops the output.
	Stop(ctx context.Context) error
}

Output is the interface for outputting data.

type Writer added in v0.3.0

type Writer interface {
	// Write writes the data to the output.
	Write(ctx context.Context, data LogRecord) error
}

Writer can consume log records.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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