ecslogging

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package ecslogging contains utility functions for ECS logging.

Package ecslogging contains utility functions for ECS logging.

Package ecslogging contains utility functions for ECS logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteHumanLogs

func WriteHumanLogs(w io.Writer, logStringers []HumanJSONStringer) error

WriteHumanLogs outputs CloudWatch logs in human-readable format.

func WriteJSONLogs

func WriteJSONLogs(w io.Writer, logStringers []HumanJSONStringer) error

WriteJSONLogs outputs CloudWatch logs in JSON format.

Types

type HumanJSONStringer

type HumanJSONStringer interface {
	HumanString() string
	JSONString() (string, error)
}

HumanJSONStringer can output in both human-readable and JSON format.

type ServiceClient

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

ServiceClient retrieves the logs of an Amazon ECS service.

func NewServiceClient

func NewServiceClient(sess *session.Session, app, env, svc string) *ServiceClient

NewServiceClient returns a ServiceClient for the svc service under env and app. The logging client is initialized from the given sess session.

func (*ServiceClient) WriteLogEvents

func (s *ServiceClient) WriteLogEvents(opts WriteLogEventsOpts) error

WriteLogEvents writes service logs.

type TaskClient

type TaskClient struct {
	GroupName string
	Tasks     []*task.Task

	Writer       io.Writer
	EventsLogger logGetter
	Describer    TasksDescriber
}

TaskClient retrieves the logs of Amazon ECS tasks.

func NewTaskClient

func NewTaskClient(sess *session.Session, groupName string, tasks []*task.Task) *TaskClient

NewTaskClient returns a TaskClient that can retrieve logs from the given tasks under the groupName.

func (*TaskClient) WriteEventsUntilStopped

func (t *TaskClient) WriteEventsUntilStopped() error

WriteEventsUntilStopped writes tasks' events to a writer until all tasks have stopped.

type TasksDescriber

type TasksDescriber interface {
	DescribeTasks(cluster string, taskARNs []string) ([]*ecs.Task, error)
}

TasksDescriber describes ECS tasks.

type WriteLogEventsOpts

type WriteLogEventsOpts struct {
	Follow    bool
	Limit     *int64
	StartTime *int64
	EndTime   *int64
	TaskIDs   []string
	// OnEvents is a handler that's invoked when logs are retrieved from the service.
	OnEvents func(w io.Writer, logs []HumanJSONStringer) error
}

WriteLogEventsOpts wraps the parameters to call WriteLogEvents.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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