Skip to content

Commit bd7aad2

Browse files
committed
Rename some field names
1 parent f4b1375 commit bd7aad2

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

logging/batch_logger.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ type batchLogger struct {
1717

1818
// BatchLoggerOptions is an options struct used by the NewBatchLogger constructor
1919
type BatchLoggerOptions struct {
20-
MaxBatchSize int // The maximum size of a batch in bytes
21-
MaxLogAge time.Duration // The maximum age of a log item in a batch - once an item is older than this, the batch is passed to the callback
22-
LogApiKey string // The API key used by the default BatchCallback used to send logs to the Firetail logging API
23-
LogApiUrl string // The URL of the Firetail logging API endpoint to send log entries to
24-
RedactRequestJSONPayloadValues bool // Whether or not values in the request payloads should be redacted, assuming they're JSON
25-
RedactResponseJSONPayloadValues bool // Whether or not values in the response payloads should be redacted, assuming they're JSON
26-
BatchCallback func([][]byte) // An optional callback to which batches will be passed; the default callback sends logs to the Firetail logging API
20+
MaxBatchSize int // The maximum size of a batch in bytes
21+
MaxLogAge time.Duration // The maximum age of a log item in a batch - once an item is older than this, the batch is passed to the callback
22+
LogApiKey string // The API key used by the default BatchCallback used to send logs to the Firetail logging API
23+
LogApiUrl string // The URL of the Firetail logging API endpoint to send log entries to
24+
RedactJSONRequestBodies bool // Whether or not values in the request payloads should be redacted, assuming they're JSON
25+
RedactJSONResponseBodies bool // Whether or not values in the response payloads should be redacted, assuming they're JSON
26+
BatchCallback func([][]byte) // An optional callback to which batches will be passed; the default callback sends logs to the Firetail logging API
2727
}
2828

2929
// NewBatchLogger creates a new batchLogger with the provided options
@@ -33,8 +33,8 @@ func NewBatchLogger(options BatchLoggerOptions) *batchLogger {
3333
maxBatchSize: options.MaxBatchSize,
3434
maxLogAge: options.MaxLogAge,
3535
batchCallback: options.BatchCallback,
36-
redactRequestBodies: options.RedactRequestJSONPayloadValues,
37-
redactResponseBodies: options.RedactResponseJSONPayloadValues,
36+
redactRequestBodies: options.RedactJSONRequestBodies,
37+
redactResponseBodies: options.RedactJSONResponseBodies,
3838
}
3939

4040
if options.BatchCallback == nil {

logging/batch_logger_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ import (
1414

1515
func SetupLogger(batchChannel chan *[][]byte, maxBatchSize int, maxLogAge time.Duration, redactRequests bool, redactResponses bool) *batchLogger {
1616
batchLogger := NewBatchLogger(BatchLoggerOptions{
17-
MaxBatchSize: maxBatchSize,
18-
MaxLogAge: maxLogAge,
19-
RedactRequestJSONPayloadValues: redactRequests,
20-
RedactResponseJSONPayloadValues: redactResponses,
17+
MaxBatchSize: maxBatchSize,
18+
MaxLogAge: maxLogAge,
19+
RedactJSONRequestBodies: redactRequests,
20+
RedactJSONResponseBodies: redactResponses,
2121
})
2222

2323
// Replace the batchHandler with a custom one to throw the batches into a queue that we can receive from for testing

middlewares/http/middleware.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ func GetMiddleware(options *Options) (func(next http.Handler) http.Handler, erro
4444
maxLogAge = options.MaxLogAge
4545
}
4646
batchLogger := logging.NewBatchLogger(logging.BatchLoggerOptions{
47-
MaxBatchSize: maxBatchSize,
48-
MaxLogAge: maxLogAge,
49-
BatchCallback: options.LogBatchCallback,
50-
LogApiKey: options.LogsApiToken,
51-
LogApiUrl: options.LogsApiUrl,
52-
RedactRequestJSONPayloadValues: options.RedactJSONRequestBodies,
53-
RedactResponseJSONPayloadValues: options.RedactJSONResponseBodies,
47+
MaxBatchSize: maxBatchSize,
48+
MaxLogAge: maxLogAge,
49+
BatchCallback: options.LogBatchCallback,
50+
LogApiKey: options.LogsApiToken,
51+
LogApiUrl: options.LogsApiUrl,
52+
RedactJSONRequestBodies: options.RedactJSONRequestBodies,
53+
RedactJSONResponseBodies: options.RedactJSONResponseBodies,
5454
})
5555

5656
middleware := func(next http.Handler) http.Handler {

0 commit comments

Comments
 (0)