critlog

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

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 io.Writer, bufSize int, maxParWrites uint8,
	flags BackpressureBufferFlags, missFn MissedEventFunc,
) *BackpressureBuffer

func NewBackpressureBufferWithBypass

func NewBackpressureBufferWithBypass(output io.Writer, 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) GetBareOutput

func (p BackpressureBuffer) GetBareOutput() io.Writer

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.
	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 io.Writer) *FatalDirectWriter

func (*FatalDirectWriter) Close

func (p *FatalDirectWriter) Close() error

func (*FatalDirectWriter) Flush

func (p *FatalDirectWriter) Flush() error

func (*FatalDirectWriter) GetBareOutput

func (p *FatalDirectWriter) GetBareOutput() io.Writer

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 FatalHelper

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

func (*FatalHelper) IsFatal

func (p *FatalHelper) IsFatal() bool

func (*FatalHelper) LockFatal

func (p *FatalHelper) LockFatal()

func (*FatalHelper) PostFatalWrite

func (p *FatalHelper) PostFatalWrite(_ insolar.LogLevel, b []byte) (int, error)

func (*FatalHelper) SetFatal

func (p *FatalHelper) SetFatal() bool

type FlushBypass

type FlushBypass struct {
	io.Writer
	// contains filtered or unexported fields
}

func NewFlushBypass

func NewFlushBypass(output io.Writer) FlushBypass

func (*FlushBypass) Close

func (p *FlushBypass) Close() error

func (*FlushBypass) ClosedError

func (p *FlushBypass) ClosedError() error

func (*FlushBypass) DoClose

func (p *FlushBypass) DoClose() (bool, error)

func (*FlushBypass) DoFlush

func (p *FlushBypass) DoFlush() (bool, error)

func (*FlushBypass) DoFlushOrSync

func (p *FlushBypass) DoFlushOrSync() (bool, error)

func (*FlushBypass) DoLevelWrite

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

func (*FlushBypass) DoSync

func (p *FlushBypass) DoSync() (bool, error)

func (*FlushBypass) DoWrite

func (p *FlushBypass) DoWrite(b []byte) (n int, err error)

func (*FlushBypass) Flush

func (p *FlushBypass) Flush() error

func (*FlushBypass) FlushOrSync

func (p *FlushBypass) FlushOrSync() error

func (*FlushBypass) IsClosed

func (p *FlushBypass) IsClosed() bool

func (*FlushBypass) LogLevelWrite

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

func (*FlushBypass) SetClosed

func (p *FlushBypass) SetClosed() bool

func (*FlushBypass) Sync

func (p *FlushBypass) Sync() error

func (*FlushBypass) Write

func (p *FlushBypass) Write(b []byte) (int, 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) GetBareOutput

func (p *ProxyLoggerOutput) GetBareOutput() io.Writer

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