mirror of https://github.com/docker/docs.git
Allow Debug messages from ec2 driver to include request / response data sent to aws.
Signed-off-by: Jeffrey Ellin <jeff@ellin.com>
This commit is contained in:
parent
e0570c0c2b
commit
6d41d8c1ad
|
|
@ -655,8 +655,11 @@ func (d *Driver) Remove() error {
|
||||||
|
|
||||||
func (d *Driver) getClient() *ec2.EC2 {
|
func (d *Driver) getClient() *ec2.EC2 {
|
||||||
config := aws.NewConfig()
|
config := aws.NewConfig()
|
||||||
|
alogger := AwsLogger()
|
||||||
config = config.WithRegion(d.Region)
|
config = config.WithRegion(d.Region)
|
||||||
config = config.WithCredentials(credentials.NewStaticCredentials(d.AccessKey, d.SecretKey, d.SessionToken))
|
config = config.WithCredentials(credentials.NewStaticCredentials(d.AccessKey, d.SecretKey, d.SessionToken))
|
||||||
|
config = config.WithLogger(alogger)
|
||||||
|
config = config.WithLogLevel(aws.LogDebugWithHTTPBody)
|
||||||
return ec2.New(session.New(config))
|
return ec2.New(session.New(config))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package amazonec2
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
type awslogger struct {
|
||||||
|
logger *log.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func AwsLogger() aws.Logger {
|
||||||
|
return &awslogger{
|
||||||
|
logger: log.New(os.Stderr, "", log.LstdFlags),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l awslogger) Log(args ...interface{}) {
|
||||||
|
l.logger.Println(args...)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue