func (svc *XRay) Infof(format string, v ...interface{}) {
	svc.logger.Infof(serviceName, format, v...)
}
Infof logging information.
package xray
import (
	"net/http"
	"time"
	"github.com/aws/aws-sdk-go/aws/session"
	SDK "github.com/aws/aws-sdk-go/service/xray"
	"github.com/evalphobia/aws-sdk-go-wrapper/config"
	"github.com/evalphobia/aws-sdk-go-wrapper/log"
	"github.com/evalphobia/aws-sdk-go-wrapper/private/errors"
)
const (
	serviceName = "X-Ray"
)
var defaultSamplingPolicy, _ = NewLimitedSampler(1, 1000)
type XRay struct {
	client   *SDK.XRay
	daemon   *Daemon
	sampling SamplingPolicy
	logger log.Logger
	prefix string
}
func New(conf config.Config) (*XRay, error) {
	sess, err := conf.Session()
	if err != nil {
		return nil, err
	}
	svc := NewFromSession(sess)
	svc.prefix = conf.DefaultPrefix
	return svc, nil
}
func NewFromSession(sess *session.Session) *XRay {
	return &XRay{
		client:   SDK.New(sess),
		logger:   log.DefaultLogger,
		sampling: defaultSamplingPolicy,
	}
}
func (svc *XRay) GetClient() *SDK.XRay {
	return svc.client
}
func (svc *XRay) SetLogger(logger log.Logger) {
	svc.logger = logger
}
func (svc *XRay) SetPrefix(prefix string) {
	svc.prefix = prefix
}
func (svc *XRay) SetSamplingPolicy(fraction, qps float64) error {
	s, err := NewLimitedSampler(fraction, qps)
	if err != nil {
		svc.Errorf("error on SetSamplingPolicy; fraction=%f; qps=%f; error=%s;", fraction, qps, err.Error())
		return err
	}
	svc.sampling = s
	return nil
}
func (svc *XRay) AddSegment(segments ...*Segment) {
	svc.daemon.Add(segments...)
}
func (svc *XRay) RunDaemon(size int, interval time.Duration) {
	svc.daemon = NewDaemon(size, interval, svc.PutTraceSegments)
	svc.daemon.Run()
}
func (svc *XRay) PutTraceSegments(segments []*Segment) error {
	if len(segments) == 0 {
		return nil
	}
	errList := newErrors()
	sep, err := createSegmentDivider(segments)
	if err != nil {
		svc.Errorf("error on createSegmentDivider(segments); error=%s;", err.Error())
		errList.Add(err)
	}
	for _, list := range sep.list {
		notProcessed, err := svc.client.PutTraceSegments(&SDK.PutTraceSegmentsInput{
			TraceSegmentDocuments: list,
		})
		if err != nil {
			_list := make([]string, len(list))
			for i, s := range list {
				_list[i] = *s
			}
			svc.Errorf("error on `PutTraceSegments` operation; segments=%v; error=%s;", _list, err.Error())
			errList.Add(err)
		}
		_ = notProcessed  
	}
	if errList.HasError() {
		return errList
	}
	return nil
}
func (svc *XRay) NewSegment(name string) *Segment {
	s := NewSegment(name)
	s.service = svc
	return s
}
func (svc *XRay) NewSegmentFromRequest(r *http.Request) *Segment {
	if !svc.sampling.CanSample() {
		return NewEmptySegment()
	}
	s := NewSegmentFromRequest(r)
	s.service = svc
	return s
}