log

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPrettyLogger

func NewPrettyLogger(name string) *prettyLogger

Types

type Logger

type Logger interface {
	// New returns a new contextual Logger that has this logger's context plus the given context.
	New(ctx ...any) Logger

	// Debug logs a message with debug level and key/value pairs, if any.
	Debug(msg string, ctx ...any)

	// Info logs a message with info level and key/value pairs, if any.
	Info(msg string, ctx ...any)

	// Warn logs a message with warning level and key/value pairs, if any.
	Warn(msg string, ctx ...any)

	// Error logs a message with error level and key/value pairs, if any.
	Error(msg string, ctx ...any)

	// FromContext returns a new contextual Logger that has this logger's context plus the given context.
	FromContext(ctx context.Context) Logger
}

Logger is the default logger

func New

func New(name string) Logger

type Logs

type Logs struct {
	Calls   int
	Message string
	Ctx     []any
	// contains filtered or unexported fields
}

func (*Logs) Call

func (l *Logs) Call(msg string, ctx ...any)

type PrettyLogger

type PrettyLogger interface {
	Successf(format string, args ...any)
	Failuref(format string, args ...any)

	Info(args ...any)
	Infof(format string, args ...any)
	Debug(args ...any)
	Debugf(format string, args ...any)
	Warn(args ...any)
	Warnf(format string, args ...any)
	Error(args ...any)
	Errorf(format string, args ...any)
}

PrettyLogger is used primarily to facilitate logging/user feedback for both the grafana-cli and the grafana backend when managing plugin installs

type TestLogger

type TestLogger struct {
	DebugLogs Logs
	InfoLogs  Logs
	WarnLogs  Logs
	ErrorLogs Logs
}

func NewTestLogger

func NewTestLogger() *TestLogger

func (*TestLogger) Debug

func (f *TestLogger) Debug(msg string, ctx ...any)

func (*TestLogger) Error

func (f *TestLogger) Error(msg string, ctx ...any)

func (*TestLogger) FromContext

func (f *TestLogger) FromContext(_ context.Context) Logger

func (*TestLogger) Info

func (f *TestLogger) Info(msg string, ctx ...any)

func (*TestLogger) New

func (f *TestLogger) New(_ ...any) Logger

func (*TestLogger) Warn

func (f *TestLogger) Warn(msg string, ctx ...any)

type TestPrettyLogger

type TestPrettyLogger struct{}

func NewTestPrettyLogger

func NewTestPrettyLogger() *TestPrettyLogger

func (*TestPrettyLogger) Debug

func (f *TestPrettyLogger) Debug(_ ...any)

func (*TestPrettyLogger) Debugf

func (f *TestPrettyLogger) Debugf(_ string, _ ...any)

func (*TestPrettyLogger) Error

func (f *TestPrettyLogger) Error(_ ...any)

func (*TestPrettyLogger) Errorf

func (f *TestPrettyLogger) Errorf(_ string, _ ...any)

func (*TestPrettyLogger) Failuref

func (f *TestPrettyLogger) Failuref(_ string, _ ...any)

func (*TestPrettyLogger) Info

func (f *TestPrettyLogger) Info(_ ...any)

func (*TestPrettyLogger) Infof

func (f *TestPrettyLogger) Infof(_ string, _ ...any)

func (*TestPrettyLogger) Successf

func (f *TestPrettyLogger) Successf(_ string, _ ...any)

func (*TestPrettyLogger) Warn

func (f *TestPrettyLogger) Warn(_ ...any)

func (*TestPrettyLogger) Warnf

func (f *TestPrettyLogger) Warnf(_ string, _ ...any)

Jump to

Keyboard shortcuts

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