testlogger

package
v0.64.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogMessage

type LogMessage struct {
	Message    string                 `json:"message"`
	Level      zerolog.Level          `json:"level"`
	Service    string                 `json:"service"`
	Error      *string                `json:"error"`
	Attributes map[string]interface{} `json:"-"`
}

type TestLogger

type TestLogger struct {
	*logger.Logger
	// contains filtered or unexported fields
}

func New

func New() *TestLogger

New returns a logger with an in memory buffer containing log messages for use in tests

func (*TestLogger) GetErrorMessages

func (l *TestLogger) GetErrorMessages() ([]LogMessage, error)

GetErrorMessages returns all log messages with error, fatal and panic level If you only want a single of those levels, use GetMessagesForLevel instead

func (*TestLogger) GetLogMessages

func (l *TestLogger) GetLogMessages() ([]LogMessage, error)

func (*TestLogger) GetMessagesForLevel

func (l *TestLogger) GetMessagesForLevel(level logger.Level) ([]LogMessage, error)

Jump to

Keyboard shortcuts

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