logf

package
v1.55.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

package logf has the log.F implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(prefix string, v interface{}, setField func(key string, value interface{}))

Marshal is a helper that checks if the interface provided implements Marshaler. If it does, it recursively calls MarshalLog building up the prefixes long (combining them with ".").

Types

type F

type F map[string]interface{}

F implements a generic log.Marshaler interface

func (F) MarshalLog

func (f F) MarshalLog(addField func(field string, value interface{}))

MarshalLog implements the Marshaler interface for F

func (F) Set

func (f F) Set(field string, value interface{})

Set writes the field value into F. If the value implements interface { MarshalRoot() log.Marshaler } then it marshals it from the root level. If the value is a log.Marshaler, it recursively marshals that value into F.

type Many

type Many []Marshaler

Many aggregates marshaling of many items

This avoids having to build an append list and also simplifies code

func (Many) MarshalLog

func (m Many) MarshalLog(addField func(key string, v interface{}))

MarshalLog calls MarshalLog on all the individual elements

type Marshaler

type Marshaler interface {
	MarshalLog(addField func(key string, v interface{}))
}

Marshaler is the same interface as log.Marshaler.

Jump to

Keyboard shortcuts

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