Documentation ¶
Index ¶
- func DoSomeLogging(cfg DoSomeLoggingCfg) (logged int32, filtered int32)
- func StringRnd(length int) string
- type Buffer
- type DoSomeLoggingCfg
- type FailingTarget
- type SlowTarget
- type TestCounter
- type TestGauge
- type TestMetrics
- type TestMetricsCollector
- func (c *TestMetricsCollector) BlockedCounter(target string) logr.Counter
- func (c *TestMetricsCollector) DroppedCounter(target string) logr.Counter
- func (c *TestMetricsCollector) ErrorCounter(target string) logr.Counter
- func (c *TestMetricsCollector) Get(target string) TestMetrics
- func (c *TestMetricsCollector) LoggedCounter(target string) logr.Counter
- func (c *TestMetricsCollector) QueueSizeGauge(target string) logr.Gauge
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoSomeLogging ¶
func DoSomeLogging(cfg DoSomeLoggingCfg) (logged int32, filtered int32)
DoSomeLogging performs some concurrent logging on a preconfigured Logr.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a simple buffer implementing io.Writer
type DoSomeLoggingCfg ¶
type DoSomeLoggingCfg struct { // Lgr is a preconfigured Logr instance. Lgr *logr.Logr // Goroutines is number of goroutines to start. Goroutines int // Loops is number of loops per goroutine. Loops int // GoodToken is some text that is output for log statements that // should be output. GoodToken string // BadToken is text that is output for log statements that should be // filtered out. BadToken string // Lvl is the Level to use for log statements. Lvl logr.Level // Delay is amount of time to pause between loops. Delay time.Duration }
DoSomeLoggingCfg is configuration for `DoSomeLogging` utility.
type FailingTarget ¶ added in v1.0.6
FailingTarget is a test target that always fails.
func NewFailingTarget ¶ added in v1.0.6
func NewFailingTarget(filter logr.Filter, formatter logr.Formatter) *FailingTarget
NewFailingTarget creates a target that always fails.
type SlowTarget ¶
SlowTarget outputs log records to any `io.Writer` with configurable delay to simulate slower targets. Modify SlowTarget.Delay to determine the pause per log record.
func NewSlowTarget ¶
func NewSlowTarget(filter logr.Filter, formatter logr.Formatter, out io.Writer, maxQueue int) *SlowTarget
NewSlowTarget creates a new SlowTarget.
func (*SlowTarget) String ¶
func (st *SlowTarget) String() string
String returns a string representation of this target.
type TestCounter ¶ added in v1.0.6
type TestCounter struct {
// contains filtered or unexported fields
}
func (*TestCounter) Add ¶ added in v1.0.6
func (c *TestCounter) Add(val float64)
func (*TestCounter) Inc ¶ added in v1.0.6
func (c *TestCounter) Inc()
type TestGauge ¶ added in v1.0.6
type TestGauge struct {
// contains filtered or unexported fields
}
type TestMetrics ¶ added in v1.0.6
type TestMetricsCollector ¶ added in v1.0.6
type TestMetricsCollector struct {
// contains filtered or unexported fields
}
func NewTestMetricsCollector ¶ added in v1.0.6
func NewTestMetricsCollector() *TestMetricsCollector
func (*TestMetricsCollector) BlockedCounter ¶ added in v1.0.6
func (c *TestMetricsCollector) BlockedCounter(target string) logr.Counter
func (*TestMetricsCollector) DroppedCounter ¶ added in v1.0.6
func (c *TestMetricsCollector) DroppedCounter(target string) logr.Counter
func (*TestMetricsCollector) ErrorCounter ¶ added in v1.0.6
func (c *TestMetricsCollector) ErrorCounter(target string) logr.Counter
func (*TestMetricsCollector) Get ¶ added in v1.0.6
func (c *TestMetricsCollector) Get(target string) TestMetrics
func (*TestMetricsCollector) LoggedCounter ¶ added in v1.0.6
func (c *TestMetricsCollector) LoggedCounter(target string) logr.Counter
func (*TestMetricsCollector) QueueSizeGauge ¶ added in v1.0.6
func (c *TestMetricsCollector) QueueSizeGauge(target string) logr.Gauge
Click to show internal directories.
Click to hide internal directories.