Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ The Attr variants are recommended for production use as they provide:

- Better IDE support: autocompletion and type checking

// Variadic - convenient but less performant
logger.Info(ctx, "user.created", "user_id", 12345, "email", "user@example.com")
Examples:

// Attr - more performant and type-safe
logger.InfoAttr(ctx, "user.created",
log.Int("user_id", 12345),
log.String("email", "user@example.com"))
// Variadic - convenient but less performant
logger.Info(ctx, "user.created", "user_id", 12345, "email", "user@example.com")

// Attr - more performant and type-safe
logger.InfoAttr(ctx, "user.created",
log.Int("user_id", 12345),
log.String("email", "user@example.com"))

# Performance

Expand Down
Loading