logger

package
v0.0.0-...-2a91a1d Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package logqueue is a set of implementations to support amboy.Queue backed grip/send.Senders for asynchronous and (generally) non-blocking log message delivery.

You can use Queue backed senders as an extension of an existing queue or use constructors that use the LimitedSizeLocalQueue do deliver messages.

These implementations do not guarantee delivery of log messages to senders in any particular order.

These senders do not provide any batching or group message sending: messages are dispatched to queues immediately upon receipt. The grip/send.NewBufferedSender implementation has these property.

The multi-sender implementation provded by this method creates a single job for every message. If you want to have a single Job for every message, use the grip/send.MakeMultiSender in combination with the single sender.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeQueueMultiSender

func MakeQueueMultiSender(q amboy.Queue, senders ...send.Sender) send.Sender

MakeQueueMultiSender returns a amboy.Queue-backed sender that distributes messages to multiple backing Sender implementations.

In most respects this Sender is like any other; however, messages may be delivered out of order, and it pushes level-based filtering down to constituent senders. Additionally, the close method does not close the constituent senders.

Internally each message maps to a single job which calls send on each constituent sender independently. This means that if a single sender is blocking, then that sender may prevent other senders from receiving the message.

func MakeQueueSender

func MakeQueueSender(q amboy.Queue, sender send.Sender) send.Sender

MakeQueueSender wraps the sender with a queue-backed delivery mechanism using the specified queue instance.

These senders do not ensure that logged messages are propagated to the underlying sender implementation in any order, and may result in out-of-order logging.

The close method does not close the underlying sender.

In the event that the sender's Put method returns an error, the message (and its error) will be logged directly (and synchronously)

func NewMultiSendMessageJob

func NewMultiSendMessageJob(m message.Composer, s []send.Sender) amboy.Job

NewMultiSendMessageJob buils and amboy.Job instance that sends a single message to a group of Sender implementations. The job sends the message to each Sender serially.

This job is not compatible with remote-storage backed queues.

func NewQueueBackedSender

func NewQueueBackedSender(ctx context.Context, sender send.Sender, workers, capacity int) (send.Sender, error)

NewQueueBackedSender creates a new LimitedSize queue, and creates a sender implementation wrapping this sender. The queue is not shared.

This sender returns an error if there is a problem starting the queue, and cancels the queue upon closing, without waiting for the queue to empty.

func NewQueueMultiSender

func NewQueueMultiSender(ctx context.Context, workers, capacity int, senders ...send.Sender) (send.Sender, error)

NewQueueMultiSender returns a queue-backed wrapper of a group of senders, but constructs the queue independently. When the Close method on this sender, the queue is canceled, which may leave some pending messages unsent.

func NewSendMessageJob

func NewSendMessageJob(m message.Composer, s send.Sender) amboy.Job

NewSendMessageJob creates an amboy.Job instance that sends the specified message to the specified sender.

This job is not compatible with remote-storage backed queues.

Types

This section is empty.

Jump to

Keyboard shortcuts

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