common

package
v0.0.0-...-5d341ca Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorHandler

type ErrorHandler interface {
	Handle(err error)
	HandleContext(ctx context.Context, err error)
}

ErrorHandler handles an error.

type Logger

type Logger interface {
	// Trace logs a trace event.
	Trace(msg string, fields ...map[string]interface{})

	// Debug logs a debug event.
	Debug(msg string, fields ...map[string]interface{})

	// Info logs an info event.
	Info(msg string, fields ...map[string]interface{})

	// Warn logs a warning event.
	Warn(msg string, fields ...map[string]interface{})

	// Error logs an error event.
	Error(msg string, fields ...map[string]interface{})

	// TraceContext logs a trace event with a context.
	TraceContext(ctx context.Context, msg string, fields ...map[string]interface{})

	// DebugContext logs a debug event with a context.
	DebugContext(ctx context.Context, msg string, fields ...map[string]interface{})

	// InfoContext logs an info event with a context.
	InfoContext(ctx context.Context, msg string, fields ...map[string]interface{})

	// WarnContext logs a warning event with a context.
	WarnContext(ctx context.Context, msg string, fields ...map[string]interface{})

	// ErrorContext logs an error event with a context.
	ErrorContext(ctx context.Context, msg string, fields ...map[string]interface{})

	// WithFields annotates a logger with key-value pairs.
	WithFields(fields map[string]interface{}) Logger

	// WithContext annotates a logger with a context.
	WithContext(ctx context.Context) Logger
}

Logger is the fundamental interface for all log operations.

type NoopErrorHandler

type NoopErrorHandler struct{}

NoopErrorHandler is an error handler that discards every error.

func (NoopErrorHandler) Handle

func (NoopErrorHandler) Handle(_ error)

func (NoopErrorHandler) HandleContext

func (NoopErrorHandler) HandleContext(_ context.Context, _ error)

type NoopLogger

type NoopLogger struct{}

NoopLogger is a logger that discards every log event.

func (NoopLogger) Debug

func (NoopLogger) Debug(_ string, _ ...map[string]interface{})

func (NoopLogger) DebugContext

func (NoopLogger) DebugContext(_ context.Context, _ string, _ ...map[string]interface{})

func (NoopLogger) Error

func (NoopLogger) Error(_ string, _ ...map[string]interface{})

func (NoopLogger) ErrorContext

func (NoopLogger) ErrorContext(_ context.Context, _ string, _ ...map[string]interface{})

func (NoopLogger) Info

func (NoopLogger) Info(_ string, _ ...map[string]interface{})

func (NoopLogger) InfoContext

func (NoopLogger) InfoContext(_ context.Context, _ string, _ ...map[string]interface{})

func (NoopLogger) Trace

func (NoopLogger) Trace(_ string, _ ...map[string]interface{})

func (NoopLogger) TraceContext

func (NoopLogger) TraceContext(_ context.Context, _ string, _ ...map[string]interface{})

func (NoopLogger) Warn

func (NoopLogger) Warn(_ string, _ ...map[string]interface{})

func (NoopLogger) WarnContext

func (NoopLogger) WarnContext(_ context.Context, _ string, _ ...map[string]interface{})

func (NoopLogger) WithContext

func (n NoopLogger) WithContext(_ context.Context) Logger

func (NoopLogger) WithFields

func (n NoopLogger) WithFields(_ map[string]interface{}) Logger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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