Documentation ¶
Index ¶
- func CloudWatchLogGroupExists(client cloudwatchlogsiface.CloudWatchLogsAPI, logGroupName string) (bool, error)
- func CreateNewCloudWatchLogGroup(client cloudwatchlogsiface.CloudWatchLogsAPI, logGroupName string) error
- func CreateNewLogStream(client cloudwatchlogsiface.CloudWatchLogsAPI, logGroupName string, ...) error
- func New(prefix string) *log.Logger
- func NewCloudWatchLogsProvider(client cloudwatchlogsiface.CloudWatchLogsAPI, logGroupName string) (io.Writer, error)
- func SetProviderLogOutput(w io.Writer)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloudWatchLogGroupExists ¶
func CloudWatchLogGroupExists(client cloudwatchlogsiface.CloudWatchLogsAPI, logGroupName string) (bool, error)
CloudWatchLogGroupExists checks if a log group exists
Using the client provided, it will check the CloudWatch Logs service to verify the log group
sess := session.Must(aws.NewConfig()) svc := cloudwatchlogs.New(sess) // checks if the pineapple-pizza log group exists ok, err := LogGroupExists(svc, "pineapple-pizza") if err != nil { panic(err) } if ok { // do something }
func CreateNewCloudWatchLogGroup ¶
func CreateNewCloudWatchLogGroup(client cloudwatchlogsiface.CloudWatchLogsAPI, logGroupName string) error
CreateNewCloudWatchLogGroup creates a log group in CloudWatch Logs.
Using a passed in client to create the call to the service, it will create a log group of the specified name
sess := session.Must(aws.NewConfig()) svc := cloudwatchlogs.New(sess) if err := CreateNewCloudWatchLogGroup(svc, "pineapple-pizza"); err != nil { panic("Unable to create log group", err) }
func CreateNewLogStream ¶
func CreateNewLogStream(client cloudwatchlogsiface.CloudWatchLogsAPI, logGroupName string, logStreamName string) error
CreateNewLogStream creates a log stream inside of a LogGroup
func NewCloudWatchLogsProvider ¶
func NewCloudWatchLogsProvider(client cloudwatchlogsiface.CloudWatchLogsAPI, logGroupName string) (io.Writer, error)
NewCloudWatchLogsProvider creates a io.Writer that writes to a specifc log group.
Each time NewCloudWatchLogsProvider is used, a new log stream is created inside the log group. The log stream will have a unique, random identifer
sess := session.Must(aws.NewConfig()) svc := cloudwatchlogs.New(sess) provider, err := NewCloudWatchLogsProvider(svc, "pineapple-pizza") if err != nil { panic(err) } // set log output to the provider, all log messages will then be // pushed through the Write func and sent to CloudWatch Logs log.SetOutput(provider) log.Printf("Eric loves pineapple pizza!")
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.