waterlog

package module
v0.0.0-...-130c993 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: BSD-3-Clause Imports: 7 Imported by: 0

README

Waterlog

A small collection of log adapters for Watermill.

The LoggerAdapter affords Watermill applications to bring their own loggers with their applications. This package provides lightly opinionated logger implementations that satisfy the LoggerAdapter interface so your logs are uniform across all components in your system.

All implementations will follow these conventions:

  • logger structs are exported, named Logger and the underlying logger is exported as Logger.L
  • new loggers use JSON formatting and use a constructor that matches func(output io.Writer, debug, trace bool) watermill.LoggerAdapter
  • debug and trace are just boolean gates; they aren't separate loggers (unlike watermill.StdLoggerAdapter)

To Do

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertJSON

func AssertJSON(t *testing.T, act, exp string)

AssertJSON asserts that two input strings are the same JSON value

func TestDebug

func TestDebug(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestDebugDisabled

func TestDebugDisabled(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestDebugFields

func TestDebugFields(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestError

func TestError(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestErrorFields

func TestErrorFields(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestInfo

func TestInfo(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestInfoFields

func TestInfoFields(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestLogger

func TestLogger(t *testing.T, newLogger NewFunc)

func TestTrace

func TestTrace(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestTraceDisabled

func TestTraceDisabled(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestTraceFields

func TestTraceFields(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

func TestWith

func TestWith(b *bytes.Buffer, l watermill.LoggerAdapter) func(t *testing.T)

Types

type NewFunc

type NewFunc func(output io.Writer, debug, trace bool) watermill.LoggerAdapter

NewFunc matches constructors for every logger implementation

type Opts

type Opts struct {
	Debug bool
	Trace bool
}

Opts controls global features across all loggers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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