loghlp

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lazy

func Lazy(f func() string) fmt.Stringer

Lazy returns an fmt.Stringer which returns the string returned by the given function.

As this function is called only when the Stringer's String() function is called, this can be used in loggers to postpone expensive tasks.

func LazyW

func LazyW(f func(io.Writer)) fmt.Stringer

LazyW returns an fmt.Stringer which returns the string written by the given function.

The io.Writer given to the function is a *bytes.Buffer cached by a sync.Pool.

As this function is called only when the Stringer's String() function is called, this can be used in loggers to postpone expensive tasks.

Types

type StringerFunc

type StringerFunc func() string

StringerFunc is a function which returns a string.

func (StringerFunc) String

func (f StringerFunc) String() string

Directories

Path Synopsis
Package kitloghlp contains some helpers for go-kit/kit/log.
Package kitloghlp contains some helpers for go-kit/kit/log.

Jump to

Keyboard shortcuts

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