critlog

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackpressureBuffer

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

Provides weak-reference behavior to enable auto-stop of workers

func NewBackpressureBuffer

func NewBackpressureBuffer(output *logoutput.Adapter, bufSize int, maxParWrites uint8,
	flags BackpressureBufferFlags, missFn MissedEventFunc,
) *BackpressureBuffer

func NewBackpressureBufferWithBypass

func NewBackpressureBufferWithBypass(output *logoutput.Adapter, bufSize int, maxParWrites uint8,
	flags BackpressureBufferFlags, missFn MissedEventFunc,
) *BackpressureBuffer

func (BackpressureBuffer) Close

func (p BackpressureBuffer) Close() error

func (BackpressureBuffer) Flush

func (p BackpressureBuffer) Flush() error

NB! Flush() may NOT be able to clean up whole buffer when there are too many pending writers

func (BackpressureBuffer) GetAvgWriteDuration

func (p BackpressureBuffer) GetAvgWriteDuration() time.Duration

func (BackpressureBuffer) IsLowLatencySupported

func (p BackpressureBuffer) IsLowLatencySupported() bool

func (BackpressureBuffer) LogLevelWrite

func (p BackpressureBuffer) LogLevelWrite(level insolar.LogLevel, b []byte) (n int, err error)

func (BackpressureBuffer) LowLatencyWrite

func (p BackpressureBuffer) LowLatencyWrite(level insolar.LogLevel, b []byte) (n int, err error)

func (BackpressureBuffer) SetAvgWriteDuration

func (p BackpressureBuffer) SetAvgWriteDuration(d time.Duration)

func (*BackpressureBuffer) StartWorker

The buffer requires a worker to scrap the buffer. Multiple workers are ok, but aren't necessary. Start of the worker will also attach a finalizer to the buffer.

func (BackpressureBuffer) Write

func (p BackpressureBuffer) Write(b []byte) (n int, err error)

type BackpressureBufferFlags

type BackpressureBufferFlags uint8
const (
	// Buffer content will not be flushed on fatal, instead a "missing X" message will be added.
	BufferDropOnFatal BackpressureBufferFlags = 1 << iota
	// Buffer may apply additional delay to writes done into a queue to equalize timings.
	// This mode requires either BufferTrackWriteDuration flag or use of SetAvgWriteDuration() externally.
	// This flag has no effect when bufferBypassForRegular is set.
	BufferWriteDelayFairness
	// With this flag the buffer will update GetAvgWriteDuration with every regular write.
	BufferTrackWriteDuration
	// When a worker is started, but all links to BackpressureBuffer were lost, then the worker will be stopped.
	// And with this flag present, the buffer (and its underlying output) will also be closed.
	BufferCloseOnStop
	// USE WITH CAUTION! This flag enables to use argument of Write([]byte) outside of the call.
	// This is AGAINST existing conventions and MUST ONLY be used when a writer's code is proprietary and never reuses the argument.
	BufferReuse
)

type FatalDirectWriter

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

func NewFatalDirectWriter

func NewFatalDirectWriter(output *logoutput.Adapter) *FatalDirectWriter

func (*FatalDirectWriter) Close

func (p *FatalDirectWriter) Close() error

func (*FatalDirectWriter) Flush

func (p *FatalDirectWriter) Flush() error

func (*FatalDirectWriter) IsLowLatencySupported

func (p *FatalDirectWriter) IsLowLatencySupported() bool

func (*FatalDirectWriter) LogLevelWrite

func (p *FatalDirectWriter) LogLevelWrite(level insolar.LogLevel, b []byte) (n int, err error)

func (*FatalDirectWriter) LowLatencyWrite

func (p *FatalDirectWriter) LowLatencyWrite(level insolar.LogLevel, b []byte) (int, error)

func (*FatalDirectWriter) Write

func (p *FatalDirectWriter) Write(b []byte) (n int, err error)

type MissedEventFunc

type MissedEventFunc func(missed int) (insolar.LogLevel, []byte)

type ProxyLoggerOutput

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

func (*ProxyLoggerOutput) Close

func (p *ProxyLoggerOutput) Close() error

func (*ProxyLoggerOutput) Flush

func (p *ProxyLoggerOutput) Flush() error

func (*ProxyLoggerOutput) GetTarget

func (p *ProxyLoggerOutput) GetTarget() insolar.LoggerOutput

func (*ProxyLoggerOutput) IsLowLatencySupported

func (p *ProxyLoggerOutput) IsLowLatencySupported() bool

func (*ProxyLoggerOutput) LogLevelWrite

func (p *ProxyLoggerOutput) LogLevelWrite(level insolar.LogLevel, b []byte) (int, error)

func (*ProxyLoggerOutput) LowLatencyWrite

func (p *ProxyLoggerOutput) LowLatencyWrite(level insolar.LogLevel, b []byte) (int, error)

func (*ProxyLoggerOutput) SetTarget

func (p *ProxyLoggerOutput) SetTarget(t insolar.LoggerOutput)

func (*ProxyLoggerOutput) Write

func (p *ProxyLoggerOutput) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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