convert

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFallback = errors.New("fallback")

Functions

func Copy

func Copy(w io.Writer, r io.Reader) (int64, error)

Types

type JSON

type JSON struct {
	io.Writer

	AppendNewLine bool
	AppendKeySafe bool
	FloatInfNaN   bool
	TimeFormat    string
	TimeZone      *time.Location

	Rename RenameFunc
	// contains filtered or unexported fields
}

func NewJSON

func NewJSON(w io.Writer) *JSON

func (*JSON) ConvertKey added in v0.22.1

func (w *JSON) ConvertKey(b, p []byte, st int) (_ []byte, i int)

func (*JSON) ConvertValue

func (w *JSON) ConvertValue(b, p []byte, st int) (_ []byte, i int)

func (*JSON) Write

func (w *JSON) Write(p []byte) (i int, err error)

type KeyRenamer

type KeyRenamer struct {
	Rewriter RewriterRule
	Fallback RewriterRule
	// contains filtered or unexported fields
}

func NewKeyRenamer

func NewKeyRenamer(rew RewriterRule, rules ...RenameRule) *KeyRenamer

func (*KeyRenamer) Append

func (w *KeyRenamer) Append(rules ...RenameRule)

func (*KeyRenamer) Rewrite

func (w *KeyRenamer) Rewrite(b, p []byte, path []tlog.RawMessage, kst, st int) ([]byte, int, error)

type Logfmt

type Logfmt struct {
	io.Writer

	TimeFormat string
	TimeZone   *time.Location

	FloatFormat    string
	FloatChar      byte
	FloatPrecision int

	QuoteChars      string
	QuoteAnyValue   bool
	QuoteEmptyValue bool

	PairSeparator  string
	KVSeparator    string
	ArrSeparator   string
	MapSeparator   string
	MapKVSeparator string

	MaxValPad int

	AppendKeySafe bool
	SubObjects    bool

	Rename RenameFunc

	Colorize bool
	KeyColor []byte
	ValColor []byte
	// contains filtered or unexported fields
}

func NewLogfmt

func NewLogfmt(w io.Writer) *Logfmt

func (*Logfmt) ConvertValue

func (w *Logfmt) ConvertValue(b, p, k []byte, st int) (_ []byte, i int)

func (*Logfmt) Write

func (w *Logfmt) Write(p []byte) (i int, err error)

type RenameFunc

type RenameFunc func(b, p, k []byte, st int) ([]byte, bool)

type RenameRule

type RenameRule struct {
	Path []tlog.RawMessage

	Rename []byte
	Prefix []byte
	Remove bool
}

type Rewriter

type Rewriter struct {
	io.Writer

	tlwire.Decoder
	tlwire.Encoder

	Rule RewriterRule
	// contains filtered or unexported fields
}

func NewRewriter

func NewRewriter(w io.Writer) *Rewriter

func (*Rewriter) Rewrite

func (w *Rewriter) Rewrite(b, p []byte, path []tlog.RawMessage, kst, st int) (r []byte, i int, err error)

func (*Rewriter) Write

func (w *Rewriter) Write(p []byte) (n int, err error)

type RewriterFunc

type RewriterFunc func(b, p []byte, path []tlog.RawMessage, kst, st int) ([]byte, int, error)

func (RewriterFunc) Rewrite

func (f RewriterFunc) Rewrite(b, p []byte, path []tlog.RawMessage, kst, st int) ([]byte, int, error)

type RewriterRule

type RewriterRule interface {
	Rewrite(b, p []byte, path []tlog.RawMessage, kst, st int) ([]byte, int, error)
}

type SimpleRenameRule

type SimpleRenameRule struct {
	Tags []TagSub
	Key  string
}

type SimpleRenamer

type SimpleRenamer struct {
	tlwire.Decoder

	Rules map[string]SimpleRenameRule

	Fallback RenameFunc
}

func (SimpleRenamer) Rename

func (r SimpleRenamer) Rename(b, p, k []byte, i int) ([]byte, bool)

type TagSub

type TagSub struct {
	Tag byte
	Sub int64
}

type Web

type Web struct {
	io.Writer

	EventTimeFormat string
	TimeFormat      string

	PickTime    bool
	PickCaller  bool
	PickMessage bool
	// contains filtered or unexported fields
}

func NewWeb

func NewWeb(w io.Writer) *Web

func (*Web) Close

func (w *Web) Close() error

func (*Web) Write

func (w *Web) Write(p []byte) (i int, err error)

Jump to

Keyboard shortcuts

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