ctxlog

package
v0.0.0-...-288f078 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0, Apache-2.0, CC-BY-SA-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(ctx context.Context, logger logrus.FieldLogger) context.Context

Context returns a new child context such that FromContext(child) returns the given logger.

func FromContext

func FromContext(ctx context.Context) logrus.FieldLogger

FromContext returns the logger suitable for the given context -- the one attached by contextWithLogger() if applicable, otherwise the top-level logger with no fields/values.

func LogWriter

func LogWriter(log func(...interface{})) io.Writer

LogWriter returns an io.Writer that writes to the given log func, which is typically (*check.C).Log().

func New

func New(out io.Writer, format, level string) *logrus.Logger

New returns a new logger with the indicated format and level.

func SetFormat

func SetFormat(format string)

SetFormat sets the current logging format to "json" or "text".

func SetLevel

func SetLevel(level string)

SetLevel sets the current logging level. See logrus for level names.

func TestLogger

func TestLogger(c interface{ Log(...interface{}) }) *logrus.Logger

Types

This section is empty.

Jump to

Keyboard shortcuts

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