memory

package
v0.0.0-...-f1b319b Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package memory is a io.Writer implementation to use when testing log lines being produced.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line struct {
	// Fields contains the log tags.
	Fields map[string]interface{} `json:"fields"`

	// Level indicates the log level.
	Level string `json:"level"`

	// Message contains the actual message string.
	Message string `json:"message"`
}

Line encapsulates the different elements that were logged.

type Writer

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

Writer implements io.Writer and provides a way to fetch the log lines that were produced.

func New

func New() *Writer

New returns a new Writer.

func (*Writer) Line

func (w *Writer) Line(index int) (Line, bool)

Line fetches the indicated log line. It also returns a boolean indicating whether the requested log line was produced.

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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