cloudwatch

package module
v0.0.0-...-bc61bde Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

README

cloudwatch

Godoc CircleCI Go Report Card codecov

This is a fork of this library which allows treating CloudWatch Log streams as io.WriterClosers and io.Readers.

Usage

session := session.Must(session.NewSession(nil))
group := NewGroup(cloudwatchlogs.New(session), "groupName")
w, err := group.Create("streamName")

io.WriteString(w, "Hello World")

r, err := group.Open("streamName")
io.Copy(os.Stdout, r)

Dependencies

This library depends on aws-sdk-go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOption

type CreateOption func(*writerImpl)

CreateOption allows setting various options on the resulting writer.

func FromToken

func FromToken(sequenceToken string) CreateOption

FromToken allows writing from an arbitrary sequence token.

func WithInputCallback

func WithInputCallback(callback func(*cloudwatchlogs.InputLogEvent)) CreateOption

WithInputCallback allows setting a function introspecting each input log event before it's sent to AWS CloudWatch Logs.

type Group

type Group interface {
	cloudwatchlogsiface.CloudWatchLogsAPI

	// Create creates a log stream in the managed group and returns an
	// implementation of io.Writer to write to it.
	Create(ctx context.Context, streamName string, opts ...CreateOption) (io.WriteCloser, error)

	// Name of the CloudWatch Logs group owned by this proxy.
	Name() string

	// Open returns an io.Readcloser to read from the log stream.
	Open(ctx context.Context, streamName string) io.ReadCloser
}

Group is an abstraction over AWS CloudWatch Logs Group, allowing one to treat it like a remote io.ReadWriter.

func NewGroup

func NewGroup(client iface.CloudWatchLogsAPI, groupName string) Group

NewGroup returns a new Group instance.

type RejectedLogEventsInfoError

type RejectedLogEventsInfoError struct {
	Info *cloudwatchlogs.RejectedLogEventsInfo
}

RejectedLogEventsInfoError wraps `cloudwatchlogs.RejectedLogEventsInfo` from the AWS SDK, and makes it an implementation of Go's error interface.

func (*RejectedLogEventsInfoError) Error

Jump to

Keyboard shortcuts

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