internal

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package internal provides helpers for concrete slog implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortedKeys

func SortedKeys(fields map[string]any) []string

SortedKeys returns a sorted list of non-empty field keys

Types

type FieldsIterator

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

FieldsIterator iterates over fields on a Log context

func (*FieldsIterator) Field

func (iter *FieldsIterator) Field() (key string, value any)

Field returns key and value of the current field

func (*FieldsIterator) Key

func (iter *FieldsIterator) Key() string

Key returns the label of the current field

func (*FieldsIterator) Next

func (iter *FieldsIterator) Next() bool

Next advances iterator to next value. it returns false to indicate end of iteration, or true when the next (or first) field is ready to be accessed using Key(), Value(), or Field() when there are no new ones

func (*FieldsIterator) Value

func (iter *FieldsIterator) Value() any

Value returns the value of the current field

type Loglet

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

Loglet represents a link on the Logger context chain

func (*Loglet) CallStack

func (ll *Loglet) CallStack() core.Stack

CallStack returns the callstack associated to a Loglet

func (*Loglet) Fields

func (ll *Loglet) Fields() (iter *FieldsIterator)

Fields returns a FieldsIterator

func (*Loglet) FieldsCount

func (ll *Loglet) FieldsCount() int

FieldsCount return the number of fields on a Log context

func (*Loglet) Level

func (ll *Loglet) Level() slog.LogLevel

Level returns the LogLevel of a Loglet

func (*Loglet) WithField

func (ll *Loglet) WithField(label string, value any) Loglet

WithField attaches a field to a new Loglet

func (*Loglet) WithFields

func (ll *Loglet) WithFields(fields map[string]any) Loglet

WithFields attaches a set of fields to a new Loglet

func (*Loglet) WithLevel

func (ll *Loglet) WithLevel(level slog.LogLevel) Loglet

WithLevel sets the LogLevel for a new Loglet

func (*Loglet) WithStack

func (ll *Loglet) WithStack(skip int) Loglet

WithStack attaches a call stack to a new Loglet

Jump to

Keyboard shortcuts

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