logmap

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringFromValue

func StringFromValue(v interface{}) string

StringFromValue creates a string from the value by calling the value's MarshalJSON or MarshalText methods if present, and otherwise calling fmt.Sprint.

Types

type IndexedMapValue

type IndexedMapValue struct {
	Value interface{}
	Index uint64
}

func (*IndexedMapValue) UnmarshalJSON

func (mi *IndexedMapValue) UnmarshalJSON(b []byte) error

UnmarshalJSON for an indexed map item. Used for sorting the resulting MapSlice.

type MapItem

type MapItem struct {
	Key   string
	Value interface{}
}

type MapSlice

type MapSlice []MapItem

func FromKeyvals

func FromKeyvals(keyvals ...interface{}) MapSlice

FromKeyvals creates an ordered map containing the keys and values of the log message. The keys are formatted to strings, as well as any values that do not implement json.Marshaler or encoding.TextMarshaler.

A final value "missing" is inserted if an odd number of values are passed to FromKeyvals.

func (MapSlice) JSONString

func (ms MapSlice) JSONString() (string, error)

JSONString creates an ordered JSON representation of the keys and values in the MapSlice.

func (MapSlice) MarshalJSON

func (ms MapSlice) MarshalJSON() ([]byte, error)

func (MapSlice) ToStringMap

func (ms MapSlice) ToStringMap() map[string]string

func (*MapSlice) UnmarshalJSON

func (ms *MapSlice) UnmarshalJSON(b []byte) error

UnmarshalJSON adds entries from the JSON object to the MapSlice.

Jump to

Keyboard shortcuts

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