echozap icon indicating copy to clipboard operation
echozap copied to clipboard

feat: Configurable IncluHeader configuration item

Open salleh opened this issue 1 year ago • 0 comments

Introduce IncludeHeader as new ZapLoggerConfig item.

The IncludeHeader will default to nil. To include specific header into the log item, pass a string slice that contains the list of header key: e.g:

echozap.ZapLoggerConfig{ IncludeHeader: []string{ echo.HeaderXRequestId, "My-Custom-Header-Key", } }

For consistency purpose, ALL the header key will be converted to lowercase before registered as the log field key (as getting the header from the http context will assume a case insensitive canonical form).

POTENTIAL BREAKING CHANGES TO RUNTIME RESULT Prior and including version 1.1.3 of #brpaz/echozap, echozap will automatically add a log field "request-id" to represent "X-Request-Id" header regardless if it is being sent or not.

With this release, it is not automatically added anymore. The log field key will not be changed and it will maintain the original header key.

salleh avatar Sep 08 '23 08:09 salleh