logplugin

package
v0.0.2-0...-26b375a Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugLineLength = int64(4096)
View Source
var NoDisplay = zapcore.Level(zap.FatalLevel + 10)

Functions

This section is empty.

Types

type BlockStreamer

type BlockStreamer interface {
	Run(blockServer *blockstream.Server)
}

type KeepLastLinesLogPlugin

type KeepLastLinesLogPlugin struct {
	*shutter.Shutter
	// contains filtered or unexported fields
}

KeepLastLinesLogPlugin takes a line and keep the last N lines as requested by the caller.

func NewKeepLastLinesLogPlugin

func NewKeepLastLinesLogPlugin(lineCount int, includeDeepMindLines bool) *KeepLastLinesLogPlugin

func (*KeepLastLinesLogPlugin) DebugDeepMind

func (p *KeepLastLinesLogPlugin) DebugDeepMind(enabled bool)

func (*KeepLastLinesLogPlugin) LastLines

func (p *KeepLastLinesLogPlugin) LastLines() []string

func (*KeepLastLinesLogPlugin) Launch

func (p *KeepLastLinesLogPlugin) Launch()

func (*KeepLastLinesLogPlugin) LogLine

func (p *KeepLastLinesLogPlugin) LogLine(in string)

func (*KeepLastLinesLogPlugin) Name

func (p *KeepLastLinesLogPlugin) Name() string

func (KeepLastLinesLogPlugin) Stop

func (p KeepLastLinesLogPlugin) Stop()

type LogPlugin

type LogPlugin interface {
	Name() string
	Launch()
	LogLine(in string)
	//Close(err error)
	Shutdown(err error)
	IsTerminating() bool
	Stop()
}

type LogPluginFunc

type LogPluginFunc func(line string)

func (LogPluginFunc) IsTerminating

func (f LogPluginFunc) IsTerminating() bool

func (LogPluginFunc) Launch

func (f LogPluginFunc) Launch()

func (LogPluginFunc) LogLine

func (f LogPluginFunc) LogLine(line string)

func (LogPluginFunc) Name

func (f LogPluginFunc) Name() string

func (LogPluginFunc) OnTerminated

func (f LogPluginFunc) OnTerminated(_ func(error))

func (LogPluginFunc) OnTerminating

func (f LogPluginFunc) OnTerminating(_ func(error))

func (LogPluginFunc) Shutdown

func (f LogPluginFunc) Shutdown(_ error)

func (LogPluginFunc) Stop

func (f LogPluginFunc) Stop()

func (LogPluginFunc) Terminated

func (f LogPluginFunc) Terminated() <-chan struct{}

type Shutter

type Shutter interface {
	Terminated() <-chan struct{}
	OnTerminating(f func(error))
	OnTerminated(f func(error))
	IsTerminating() bool
	Shutdown(err error)
}

type ToConsoleLogPlugin

type ToConsoleLogPlugin struct {
	*shutter.Shutter
	// contains filtered or unexported fields
}

ToConsoleLogPlugin takes a line, and if it's not a DMLOG line or if we are actively debugging deep mind, will print the line to the standard output

func NewToConsoleLogPlugin

func NewToConsoleLogPlugin(debugDeepMind bool) *ToConsoleLogPlugin

func (*ToConsoleLogPlugin) DebugDeepMind

func (p *ToConsoleLogPlugin) DebugDeepMind(enabled bool)

func (*ToConsoleLogPlugin) Launch

func (p *ToConsoleLogPlugin) Launch()

func (*ToConsoleLogPlugin) LogLine

func (p *ToConsoleLogPlugin) LogLine(in string)

func (*ToConsoleLogPlugin) Name

func (p *ToConsoleLogPlugin) Name() string

func (ToConsoleLogPlugin) Stop

func (p ToConsoleLogPlugin) Stop()

type ToZapLogPlugin

type ToZapLogPlugin struct {
	*shutter.Shutter
	// contains filtered or unexported fields
}

ToZapLogPlugin takes a line, and if it's not a DMLOG line or if we are actively debugging deep mind, will print the line to received logger instance.

func NewToZapLogPlugin

func NewToZapLogPlugin(debugDeepMind bool, logger *zap.Logger, options ...ToZapLogPluginOption) *ToZapLogPlugin

func (*ToZapLogPlugin) DebugDeepMind

func (p *ToZapLogPlugin) DebugDeepMind(enabled bool)

func (*ToZapLogPlugin) Launch

func (p *ToZapLogPlugin) Launch()

func (*ToZapLogPlugin) LogLine

func (p *ToZapLogPlugin) LogLine(in string)

func (*ToZapLogPlugin) Name

func (p *ToZapLogPlugin) Name() string

func (ToZapLogPlugin) Stop

func (p ToZapLogPlugin) Stop()

type ToZapLogPluginOption

type ToZapLogPluginOption interface {
	// contains filtered or unexported methods
}

func ToZapLogPluginLogLevel

func ToZapLogPluginLogLevel(extractLevel func(in string) zapcore.Level) ToZapLogPluginOption

ToZapLogPluginLogLevel is the option that defines which function to use to extract the log level from the line.

The received function will be invoked with the actual line to log. The function should then return the log level value to use for this line. If the return value is the special value `NoDisplay` constant (which corresponds to log level `15` which does not exist within zap), the line is actually discarded completely and not logged to the logger.

func ToZapLogPluginTransformer

func ToZapLogPluginTransformer(transformer func(in string) string) ToZapLogPluginOption

ToZapLogPluginTransformer is the option that defines which function to use to transform the line before being logged to the logger.

The received function will be invoked with the actual line to log **after** the level have been determined. The function should then return the transformed line. If the return line is the empty string, it is discarded completely.

Jump to

Keyboard shortcuts

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