binary

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package binary provides a binary format for structured logging with slog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(r io.Reader, v DecodeVisitor) error

func PutEncoder

func PutEncoder(e *Encoder)

Types

type DecodeVisitor

type DecodeVisitor interface {
	Int(key []byte, val int64)
	Uint(key []byte, val uint64)
	String(key, val []byte)
	Bytes(key, val []byte)
	Bool(key []byte, val bool)
	Float(key []byte, val float64)
	Duration(key []byte, val time.Duration)
	Time(key []byte, val time.Time)
	Group(n int)
}

type Encoder

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

func GetEncoder

func GetEncoder() *Encoder

func (*Encoder) EncodeKey

func (e *Encoder) EncodeKey(key string)

func (*Encoder) EncodeValue

func (e *Encoder) EncodeValue(v slog.Value)

func (*Encoder) WriteTo

func (e *Encoder) WriteTo(w io.Writer) (int, error)

Jump to

Keyboard shortcuts

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