testlog

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 6 Imported by: 0

README

testlog

Logging of sirkon/errors in tests, including context.

Installation

go get github.com/sirkon/errors

Usage

Just use helper functions:

testlog.Log(t, errors.New("log entry"))
testlog.Error(t, errors.New("some serious error"))

or

tl := testlog.New(t)
tl.Log(errors.New("log entry"))
tl.Error(errors.New("som serious error"))

PS

Tests are meant to fail in this module.

Documentation

Overview

Package testlog context aware github.com/sirkon/errors.Error logging in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(t TestingPrinter, err error) bool

Check do nothing and return false if error is nil. Prints error and return true otherwise.

func Error

func Error(t TestingPrinter, err error)

Error signal error.

func Log

func Log(t TestingPrinter, err error)

Log logs error.

Types

type TestLog added in v0.1.0

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

TestLog logger with stored TestingPrinter.

func New added in v0.1.0

func New(t TestingPrinter) TestLog

New creates TestLogInstance.

func (TestLog) Error added in v0.1.0

func (tl TestLog) Error(err error)

Error signal an error.

func (TestLog) Log added in v0.1.0

func (tl TestLog) Log(err error)

Log logs an error.

type TestingPrinter

type TestingPrinter interface {
	Output() io.Writer
}

TestingPrinter wrapper over *testing.T to print data

Jump to

Keyboard shortcuts

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