cowl

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

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

Go to latest
Published: Oct 24, 2017 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package cowl implements an io.Writer that sends logs in batches to Cloudwatch Logs. Copyright © 2017 Reed O'Brien <reed+oss@reedobrien.com>. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.

Index

Constants

View Source
const (
	// DefaultFlushPeriod is the default period between flushes if the max size
	// threshold isn't met.
	DefaultFlushPeriod = 10 * time.Second
	// DefaultFlushSize is the maximum size the buffer can reach before
	// flushing if the flush period duration hasn't passed.
	DefaultFlushSize = 1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer struct {
	API         ClientAPI
	FlushPeriod time.Duration
	FlushSize   int
	// contains filtered or unexported fields
}

Writer implements io.Writer and sends the incoming stream to CloudWatch Logs in batches.

func MustNewWriter

func MustNewWriter(api ClientAPI, group, stream string, options ...func(*Writer)) *Writer

MustNewWriter returns a new Writer for use or panics.

func MustNewWriterWithContext

func MustNewWriterWithContext(ctx context.Context, api ClientAPI, group, stream string, options ...func(*Writer)) *Writer

MustNewWriterWithContext returns a Writer using the provided context.

func (*Writer) Close

func (w *Writer) Close()

Close closes the channel that accepts events. Signaling it is time to flush and exit.

func (*Writer) Closed

func (w *Writer) Closed() bool

Closed returns if the writer has already been closed.

func (*Writer) LogGroup

func (w *Writer) LogGroup() string

LogGroup returns the log group this writer writes to.

func (*Writer) LogStream

func (w *Writer) LogStream() string

LogStream returns the log stream this writer writes to.

func (*Writer) Token

func (w *Writer) Token() string

Token returns the value of the next sequence token for CWL.

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

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