log

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetEntryInContext added in v0.2.0

func SetEntryInContext(ctx context.Context, e Entry) context.Context

SetEntryInContext stores an Entry in the request context.

Types

type Entry

type Entry interface {
	// Basic Logging Operation
	Debugf(format string, args ...any)
	Infof(format string, args ...any)
	Warnf(format string, args ...any)
	Errorf(format string, args ...any)

	// Attach contextual information to the logging entry
	WithFields(fields map[string]any) Entry

	// SystemErr is a method that disects the error
	// and logs the appropriate level and fields for it.
	SystemErr(err error)
}

Entry is an abstraction to the Logger and the logrus.Entry so that *Logger always creates an Entry copy which ensures no Fields are being overwritten.

func EntryFromContext added in v0.2.0

func EntryFromContext(ctx context.Context) Entry

EntryFromContext returns an Entry that has been stored in the request context. If there is no value for the key or the type assertion fails, it returns a new entry from the provided logger.

type Logger

type Logger struct {
	*logrus.Logger
}

Logger is the main struct that any athens internal service should use to communicate things.

func New

func New(cloudProvider string, level logrus.Level, format string) *Logger

New constructs a new logger based on the environment and the cloud platform it is running on. TODO: take cloud arg and env to construct the correct JSON formatter.

func NoOpLogger added in v0.2.0

func NoOpLogger() *Logger

NoOpLogger provides a Logger that does nothing.

func (*Logger) SystemErr

func (l *Logger) SystemErr(err error)

SystemErr Entry implementation.

func (*Logger) WithFields

func (l *Logger) WithFields(fields map[string]any) Entry

WithFields Entry implementation.

Jump to

Keyboard shortcuts

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