printer

package
v0.0.0-...-d4ca6f9 Latest Latest
Warning

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

Go to latest
Published: May 27, 2023 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcast

type Broadcast struct {
	PrinterConfigs []Config
	// contains filtered or unexported fields
}

Broadcast is a printer that broadcasts events to multiple printers

func NewBroadcast

func NewBroadcast(printerConfigs []Config, containerMode ContainerMode) (*Broadcast, error)

NewBroadcast creates a new Broadcast printer

func (*Broadcast) Close

func (b *Broadcast) Close()

Close closes Broadcast printer

func (*Broadcast) Epilogue

func (b *Broadcast) Epilogue(stats metrics.Stats)

func (*Broadcast) Init

func (b *Broadcast) Init() error

func (*Broadcast) Preamble

func (b *Broadcast) Preamble()

func (*Broadcast) Print

func (b *Broadcast) Print(event trace.Event)

Print broadcasts the event to all printers

type Config

type Config struct {
	Kind          string
	OutPath       string
	OutFile       io.WriteCloser
	ContainerMode ContainerMode
	RelativeTS    bool
}

type ContainerMode

type ContainerMode int
const (
	ContainerModeDisabled ContainerMode = iota
	ContainerModeEnabled
	ContainerModeEnriched
)

type EventPrinter

type EventPrinter interface {
	// Init serves as the initializer method for every event Printer type
	Init() error
	// Preamble prints something before event printing begins (one time)
	Preamble()
	// Epilogue prints something after event printing ends (one time)
	Epilogue(stats metrics.Stats)
	// Print prints a single event
	Print(event trace.Event)
	// dispose of resources
	Close()
}

func New

func New(config Config) (EventPrinter, error)

type PolicyEventPrinter

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

PolicyEventPrinter is an EventPrinter that prints events based on a policy Each policy can define a global action or action per events. A map is created between policy:event or policy to printerName which is used to send events to the correct printer

func NewPolicyEventPrinter

func NewPolicyEventPrinter(pConfigs []Config, policies []policy.PolicyFile, containerMode ContainerMode) (*PolicyEventPrinter, error)

NewPolicyEventPrinter creates a new PolicyEventPrinter

func (*PolicyEventPrinter) Close

func (pp *PolicyEventPrinter) Close()

dispose of resources

func (*PolicyEventPrinter) Epilogue

func (pp *PolicyEventPrinter) Epilogue(stats metrics.Stats)

Epilogue prints something after event printing ends (one time)

func (*PolicyEventPrinter) Init

func (pp *PolicyEventPrinter) Init() error

Init serves as the initializer method for every event Printer type

func (*PolicyEventPrinter) Preamble

func (pp *PolicyEventPrinter) Preamble()

Preamble prints something before event printing begins (one time)

func (*PolicyEventPrinter) Print

func (pp *PolicyEventPrinter) Print(event trace.Event)

Print prints a single event

Jump to

Keyboard shortcuts

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