internal

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const KnownCallerDepth = 5

KnownCallerDepth is the internally known call stack depth.

Variables

View Source
var (
	// DefaultExitFunc is the default exit function for all logger instances.
	DefaultExitFunc = os.Exit

	// EmptyExitFunc is the empty exit function for all logger instances.
	EmptyExitFunc = func(int) {}

	// DefaultPanicFunc is the default panic function for all logger instances.
	DefaultPanicFunc = func(s string) { panic(s) }

	// EmptyPanicFunc is the empty panic function for all logger instances.
	EmptyPanicFunc = func(string) {}

	// DefaultNowFunc is the default now function for all logger instances.
	DefaultNowFunc = time.Now

	// DefaultTimeFormat is the default time format for all logger instances.
	DefaultTimeFormat = time.RFC3339

	// DefaultCallerReporter is the default caller for all logger instances.
	DefaultCallerReporter = new(CallerReporter)

	// ErrorWriter is used to output logger internal error messages.
	ErrorWriter io.Writer = os.Stderr
)

Functions

func EchoError

func EchoError(format string, args ...interface{})

EchoError writes the given logger internal error message to ErrorWriter.

func StandardiseFieldsForJSONEncoder

func StandardiseFieldsForJSONEncoder(src map[string]interface{}) map[string]interface{}

StandardiseFieldsForJSONEncoder standardizes the given log fields.

Types

type CallerReporter

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

CallerReporter defines the log caller reporter.

func NewCallerReporter

func NewCallerReporter(skip int) *CallerReporter

NewCallerReporter returns a CallerReporter instance.

func (*CallerReporter) Equal

func (o *CallerReporter) Equal(skip int) bool

Equal determines whether the given skip is equal to the current caller reporter.

func (*CallerReporter) GetCaller

func (o *CallerReporter) GetCaller() string

GetCaller reports file and line number information about function invocations on the calling goroutine's stack.

type Fields

type Fields map[string]interface{}

Fields type defines the dynamic field collection of the log. After Fields are created, their stored keys will not change.

func (Fields) Clone

func (fs Fields) Clone(n int) Fields

Clone returns a cloned Fields. If n is given, the returned fields will be pre-expanded with equal capacity.

func (Fields) With

func (fs Fields) With(src map[string]interface{}) Fields

With returns a cloned Fields and adds the given data to it.

Jump to

Keyboard shortcuts

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