logging

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package logging provides repository-internal structured logging test helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestLogger

type TestLogger struct {
	*zerolog.Logger
	Buffer *bytes.Buffer
}

TestLogger creates a test logger that captures output.

func New

func New(t testing.TB) *TestLogger

New creates a test logger that captures output.

func (*TestLogger) AssertContains

func (tl *TestLogger) AssertContains(t testing.TB, substr string)

AssertContains asserts that the log contains the given string.

func (*TestLogger) AssertCount

func (tl *TestLogger) AssertCount(t testing.TB, expected int)

AssertCount asserts that the log has the expected number of entries.

func (*TestLogger) AssertNotContains

func (tl *TestLogger) AssertNotContains(t testing.TB, substr string)

AssertNotContains asserts that the log does not contain the given string.

func (*TestLogger) Clear

func (tl *TestLogger) Clear()

Clear clears the captured log output.

func (*TestLogger) Contains

func (tl *TestLogger) Contains(substr string) bool

Contains checks if the log output contains the given string.

func (*TestLogger) ContainsAll

func (tl *TestLogger) ContainsAll(substrs ...string) bool

ContainsAll checks if the log output contains all given strings.

func (*TestLogger) ContainsAny

func (tl *TestLogger) ContainsAny(substrs ...string) bool

ContainsAny checks if the log output contains any of the given strings.

func (*TestLogger) Count

func (tl *TestLogger) Count() int

Count returns the number of log entries.

func (*TestLogger) Lines

func (tl *TestLogger) Lines() []string

Lines returns the captured log output as individual lines.

func (*TestLogger) Output

func (tl *TestLogger) Output() string

Output returns the captured log output as a string.

Jump to

Keyboard shortcuts

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