Documentation ¶
Index ¶
- Constants
- func BatchSize(batchSize int) func(*logger)
- func Debug(debug func(...interface{})) func(*logger)
- func Interval(t time.Duration) func(*logger)
- func New(client CloudWatchLogs, groupName, streamName string, configs ...func(*logger)) (io.WriteCloser, error)
- func WithBatchSize(w io.WriteCloser, batchSize int) io.WriteCloser
- func WithDebug(w io.WriteCloser, debug func(...interface{})) io.WriteCloser
- type CloudWatchLogs
Constants ¶
const ( // Maximum number of records to be saved before calling PutLogEvents MaxBatchSize = 1000 // Default number of records to be saved before calling PutLogEvents DefaultBatchSize = 1000 // Length of time to wait with no new records before shipping what records we have DefaultTimeout = time.Second * 15 )
const (
ResourceAlreadyExistsException = "ResourceAlreadyExistsException"
)
Variables ¶
This section is empty.
Functions ¶
func BatchSize ¶
func BatchSize(batchSize int) func(*logger)
The default batch size is MaxBatchSize. While this should be suitable for most cases, you have the option of changing this.
func New ¶
func New(client CloudWatchLogs, groupName, streamName string, configs ...func(*logger)) (io.WriteCloser, error)
New instantiates a new io.WriteCloser instance that asynchronously writes records to CloudWatchLogs. cloudwriter assumes that records will be divided using a newline character.
client is an optional instance of *cloudwatchlogs.CloudWatchLogs
streamName supports go template style interpolation with {{ .Timestamp }}
func WithBatchSize ¶
func WithBatchSize(w io.WriteCloser, batchSize int) io.WriteCloser
The default batch size is MaxBatchSize. While this should be suitable for most cases, you have the option of changing this.
func WithDebug ¶
func WithDebug(w io.WriteCloser, debug func(...interface{})) io.WriteCloser
For testing, enables debug messages to be printed.
Types ¶
type CloudWatchLogs ¶
type CloudWatchLogs interface { DescribeLogStreams(input *cloudwatchlogs.DescribeLogStreamsInput) (*cloudwatchlogs.DescribeLogStreamsOutput, error) PutLogEvents(in *cloudwatchlogs.PutLogEventsInput) (*cloudwatchlogs.PutLogEventsOutput, error) CreateLogGroup(*cloudwatchlogs.CreateLogGroupInput) (*cloudwatchlogs.CreateLogGroupOutput, error) CreateLogStream(*cloudwatchlogs.CreateLogStreamInput) (*cloudwatchlogs.CreateLogStreamOutput, error) }
CloudWatchLogs is an interface that provides the minimal shape of *cloudwatchlogs.CloudWatchLogs and simplifies testing