log

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package log implements a component to handle logging internal to the agent.

The log methods can be called at any point in the component's lifecycle, but will be buffered until the component starts and only written after that time.

Index

Constants

This section is empty.

Variables

View Source
var MockModule fx.Option = fx.Provide(newMockLogger)

MockModule defines the fx options for the mock component.

View Source
var Module fx.Option = fx.Provide(newLogger)

Module defines the fx options for this component.

Functions

This section is empty.

Types

type Component

type Component interface {
	// Configure defines the settings for the logger.  This can be called
	// before the component starts, such as in an fx.Invoke.  It must only be
	// called once, typically from the App initialization.
	Configure(level string) error

	// Debug logs at the debug level.
	Debug(v ...interface{})

	// Flush flushes the underlying inner log
	Flush()
}

Component is the component type.

type Mock added in v0.0.2

type Mock interface {
	Component

	// SetT sets the testing instance to which log messages should be copied.
	// If this is not called, log messages are not written anywhere.
	SetT(*testing.T)

	// StartCapture begins capturing log messages.  All log messages are
	// captured, regardless of level.
	StartCapture()

	// Captured returns the log messages captured so far.  The returned slice
	// is a copy and will not be modified after return
	Captured() []string

	// EndCapture ends capturing log messages and discards buffered log
	// messages.  It's not required to call this.
	EndCapture()
}

Mock is the mocked component type.

Jump to

Keyboard shortcuts

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