gosimlog

package
v0.0.0-...-ffd3a61 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Stack

func Stack(skip int, base uintptr) slog.Attr

Stack captures a stack with runtime.Callers and return a stackframes slog.Attr. If base is non-zero, Stack will skip frames until encountering base as a PC, which is helpful for calling Stack in a slog handler.

func StackFor

func StackFor(stack []uintptr, base uintptr) slog.Attr

StackFor returns a stackframes attr for a stack captured with runtime.Callers.

Types

type BitflagChoice

type BitflagChoice struct {
	Mask   int
	Values map[int]string
}

type BitflagFormatter

type BitflagFormatter struct {
	Choices []BitflagChoice
	Flags   []BitflagValue
}

func (*BitflagFormatter) Format

func (f *BitflagFormatter) Format(value int) string

type BitflagValue

type BitflagValue struct {
	Value int
	Name  string
}

type Log

type Log struct {
	Index int `json:"-"`

	Time        time.Time     `json:"time"`
	Level       slog.Level    `json:"level"`
	Msg         string        `json:"msg"`
	Source      *Stackframe   `json:"source"`
	Step        int           `json:"step"`
	RelatedStep int           `json:"relatedStep"`
	Stackframes []*Stackframe `json:"stackframes"`
	Machine     string        `json:"machine"`
	Goroutine   int           `json:"goroutine"`
	TraceKind   string        `json:"traceKind"`

	Unknown []UnknownField `json:"-"` // for extra fields
}

func ParseLog

func ParseLog(logs []byte) []*Log

func (*Log) UnmarshalJSON

func (l *Log) UnmarshalJSON(b []byte) error

type Stackframe

type Stackframe struct {
	File     string `json:"file"`
	Function string `json:"function"`
	Line     int    `json:"line"`
}

type UnknownField

type UnknownField struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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