base

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Worker

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

Worker implements a queue worker with fixed buffer size.

func NewWorker

func NewWorker(wd WorkerDoer, queueSize int) *Worker

NewWorker returns a new worker for the writer.

func (*Worker) Enqueue

func (w *Worker) Enqueue(item sparalog.Item)

Enqueue an item and returns immediately, or blocks while the internal queue is full.

func (*Worker) Start

func (w *Worker) Start()

Start the worker.

func (*Worker) Stop

func (w *Worker) Stop(timeoutSecs int)

Stop the queue and wait for in-progress items.

type WorkerDoer

type WorkerDoer interface {
	ProcessQueueItem(sparalog.Item)
	FeedbackItem(sparalog.Item)
}

WorkerDoer is the interface that the writer should implements.

type Writer

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

Writer implements the base methods.

func (*Writer) Close

func (w *Writer) Close()

func (*Writer) Feedback

func (w *Writer) Feedback(level sparalog.Level, args ...interface{})

Feedback generate an item and send it to the level default writer of the logger.

func (*Writer) FeedbackItem

func (w *Writer) FeedbackItem(item sparalog.Item)

FeedbackItem send an item to the level default writer of ther logger.

func (*Writer) Feedbackf

func (w *Writer) Feedbackf(level sparalog.Level, format string, args ...interface{})

Feedbackf generate an item and send it to the level default writer of the logger.

func (*Writer) Open

func (w *Writer) Open() error

func (*Writer) SetFeedbackChan

func (w *Writer) SetFeedbackChan(ch chan sparalog.Item)

SetFeedbackChan set a channel to the level default writer of the logger.

Jump to

Keyboard shortcuts

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