log

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, err error)

Debug will log err if the context has debug logging enabled.

func Debugf

func Debugf(ctx context.Context, format string, args ...interface{})

Debugf will log the formatted string if the context has debug logging enabled.

func EnableDebug

func EnableDebug(ctx context.Context) context.Context

EnableDebug will return a context where debug logging is enabled for it and all child contexts.

func EnableJSON

func EnableJSON()

EnableJSON sets the output log format to JSON

func EnableStacks

func EnableStacks()

EnableStacks enables stack information via the Source field.

func EnableVerbose

func EnableVerbose()

EnableVerbose sets verbose logging. All debug messages will be logged.

func ErrorsOnly added in v0.23.0

func ErrorsOnly()

ErrorsOnly will disable all log output except errors.

func Log

func Log(ctx context.Context, err error)

Log will log an application error.

func Logf

func Logf(ctx context.Context, format string, args ...interface{})

Logf will log application information.

func RequestID

func RequestID(ctx context.Context) string

RequestID will return the associated RequestID or empty string if missing.

func SetOutput added in v0.25.0

func SetOutput(out io.Writer)

SetOutput will change the log output.

func SetRequestID

func SetRequestID(ctx context.Context) context.Context

SetRequestID will assign a unique ID to the context for tracing.

func WithField

func WithField(ctx context.Context, field string, value interface{}) context.Context

WithField will return a context with the specified field set to value.

func WithFields

func WithFields(ctx context.Context, fields Fields) context.Context

WithFields will return a context with the provided fields set.

Types

type Fields

type Fields map[string]interface{}

Fields are used to add values in structured logging.

func ContextFields

func ContextFields(ctx context.Context) Fields

ContextFields will return the current set of fields associated with a context.

Jump to

Keyboard shortcuts

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