uber-go/zap

Logging
import "go.uber.org/zap"

Blazing fast, structured, leveled logging in Go from Uber.

Example

package main

import "go.uber.org/zap"

func main() {
    logger, _ := zap.NewProduction()
    defer logger.Sync()
    logger.Info("user logged in",
        zap.String("username", "alice"),
        zap.Int("attempt", 1),
    )
}

Key Types & Functions

LoggerSugaredLoggerNewProductionNewDevelopmentFieldStringInt

About uber-go/zap

The uber-go/zap package (imported as go.uber.org/zap) belongs to the Logging category of Go packages. Blazing fast, structured, leveled logging in Go from Uber.

Go's standard library is one of the language's greatest strengths, providing production-ready implementations for networking, cryptography, encoding, I/O, and more. The uber-go/zap package follows Go's philosophy of simplicity and composability — small, focused packages that combine through interfaces like io.Reader and io.Writer.

When using uber-go/zap in production, follow Go best practices: handle errors explicitly, use context for cancellation and timeouts, prefer composition over inheritance, and write table-driven tests. The Go documentation at pkg.go.dev provides comprehensive API references and examples for every exported type and function.

Related Packages