yall

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 1 Imported by: 0

README

Yall

Yall is just a simple logging interface, similar to logr, with some differences based on how we are currently logging in our applications; and a thin wrapper around a zap sugared logger.

Documentation

Index

Constants

View Source
const (
	ExecutionIDKey executionIDType = "executionID"
)
View Source
const (
	MissingExecutionID = "missing_execution_id"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextLogger added in v0.0.3

type ContextLogger interface {
	Fatal(ctx context.Context, msg string, keysAndValues ...interface{})
	Panic(ctx context.Context, msg string, keysAndValues ...interface{})
	Error(ctx context.Context, msg string, keysAndValues ...interface{})
	Warn(ctx context.Context, msg string, keysAndValues ...interface{})
	Info(ctx context.Context, msg string, keysAndValues ...interface{})
	Debug(ctx context.Context, msg string, keysAndValues ...interface{})
}

ContextLogger is the interface of a logger, that has methods to log with a context. keysAndValues has to be formed by pairs of key and value, or single Fields.

type Field added in v0.0.3

type Field struct {
	Name  string
	Value interface{}
}

Field is a loggable object, that can be used instead of key value pairs

func Error added in v0.0.3

func Error(err error) *Field

Error is a convenience method to make logging errors easier.

type Logger

type Logger interface {
	ContextLogger
	NoContextLogger
	With(args ...interface{}) Logger
	ExecutionIDFrom(ctx context.Context) string
}

Logger is the interface of a logger, that has methods to log with a context or without. With is used to decorate the logger with key-value pairs. ExecutionIDFrom allows to extract the execution id from the context, if present, and depends on the concrete logger implementation.

type NoContextLogger added in v0.0.3

type NoContextLogger interface {
	Fatalnc(msg string, keysAndValues ...interface{})
	Panicnc(msg string, keysAndValues ...interface{})
	Errornc(msg string, keysAndValues ...interface{})
	Warnnc(msg string, keysAndValues ...interface{})
	Infonc(msg string, keysAndValues ...interface{})
	Debugnc(msg string, keysAndValues ...interface{})
}

NoContextLogger is the interface of a logger, that has methods to log without a context. keysAndValues has to be formed by pairs of key and value, or single Fields.

Directories

Path Synopsis
Package zap_logger provides an implementation of the Yall logger interface
Package zap_logger provides an implementation of the Yall logger interface

Jump to

Keyboard shortcuts

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