Skip to content

Commit

Permalink
fix: replace trace-id by trace_id
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Aug 17, 2024
1 parent 85dd438 commit c8628d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ Attributes will be injected in log payload.
Other global parameters:

```go
slogecho.TraceIDKey = "trace-id"
slogecho.SpanIDKey = "span-id"
slogecho.TraceIDKey = "trace_id"
slogecho.SpanIDKey = "span_id"
slogecho.RequestBodyMaxSize = 64 * 1024 // 64KB
slogecho.ResponseBodyMaxSize = 64 * 1024 // 64KB
slogecho.HiddenRequestHeaders = map[string]struct{}{ ... }
Expand Down
5 changes: 3 additions & 2 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const (
)

var (
TraceIDKey = "trace-id"
SpanIDKey = "span-id"
TraceIDKey = "trace_id"
SpanIDKey = "span_id"
RequestIDKey = "id"

RequestBodyMaxSize = 64 * 1024 // 64KB
Expand Down Expand Up @@ -308,6 +308,7 @@ func NewWithConfig(logger *slog.Logger, config Config) echo.MiddlewareFunc {
}
}

// AddCustomAttributes adds custom attributes to the request context.
func AddCustomAttributes(c echo.Context, attr slog.Attr) {
v := c.Get(customAttributesCtxKey)
if v == nil {
Expand Down

0 comments on commit c8628d6

Please sign in to comment.