Skip to content

Commit

Permalink
refactor: Simplify log field assignment in NewItemExporter
Browse files Browse the repository at this point in the history
  • Loading branch information
samcm committed Jun 29, 2024
1 parent 3409b89 commit c4f31c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/output/http/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ type ItemExporter struct {
}

func NewItemExporter(name string, config *Config, log logrus.FieldLogger) (ItemExporter, error) {
log = log.WithField("output_name", name).WithField("output_type", SinkType)

t := http.DefaultTransport.(*http.Transport).Clone()

if config.KeepAlive != nil && !*config.KeepAlive {
log.WithField("keep_alive", *config.KeepAlive).Warn("Disabling keep-alives")

t.DisableKeepAlives = true
}

return ItemExporter{
config: config,
log: log.WithField("output_name", name).WithField("output_type", SinkType),
log: log,

client: &http.Client{
Transport: t,
Expand Down

0 comments on commit c4f31c1

Please sign in to comment.