Help us shape the future of Go! Take the 2026 Go Developer Survey

loggingtest

package
v0.27.61 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0, MIT Imports: 7 Imported by: 4

Documentation

Overview

Package loggingtest is a test infrastructure package to support logging module tests.

Index

Constants

This section is empty.

Variables

View Source
var ErrWaitTimeout = errors.New("timeout")

ErrWaitTimeout is returned when a logging event doesn't happen within a timeout.

Functions

This section is empty.

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger provides an implementation of the logging.Logger interface that can be used to receive notifications about log events.

func New

func New() *Logger

New returns a new, initialized instance of Logger.

func (*Logger) Close

func (tl *Logger) Close()

Close the logger.

func (*Logger) Count added in v0.9.119

func (tl *Logger) Count(expression string) int

Count returns the recorded messages that match exp.

func (*Logger) Debug

func (tl *Logger) Debug(a ...any)

func (*Logger) Debugf

func (tl *Logger) Debugf(f string, a ...any)

func (*Logger) Error

func (tl *Logger) Error(a ...any)

func (*Logger) Errorf

func (tl *Logger) Errorf(f string, a ...any)

func (*Logger) Fire added in v0.13.119

func (tl *Logger) Fire(entry *logrus.Entry) error

func (*Logger) Info

func (tl *Logger) Info(a ...any)

func (*Logger) Infof

func (tl *Logger) Infof(f string, a ...any)

func (*Logger) Levels added in v0.13.119

func (tl *Logger) Levels() []logrus.Level

func (*Logger) Mute added in v0.9.80

func (tl *Logger) Mute()

func (*Logger) Reset

func (tl *Logger) Reset()

Reset clears the stored logging events.

func (*Logger) Unmute added in v0.9.80

func (tl *Logger) Unmute()

func (*Logger) WaitFor

func (tl *Logger) WaitFor(exp string, to time.Duration) error

WaitFor returns nil when a logging event matching exp was received or returns ErrWaitTimeout when to timeout expired.

func (*Logger) WaitForN

func (tl *Logger) WaitForN(exp string, n int, to time.Duration) error

WaitForN returns nil when n logging events matching exp were received or returns ErrWaitTimeout when to timeout expired.

func (*Logger) Warn

func (tl *Logger) Warn(a ...any)

func (*Logger) Warnf

func (tl *Logger) Warnf(f string, a ...any)

Jump to

Keyboard shortcuts

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