// Package logz provides structured logging backed by [log/slog]. // // Create a logger with [New]: // // logger := logz.New(logz.Options{ // Level: slog.LevelDebug, // JSON: true, // StaticArgs: []any{"service", "api", "env", "production"}, // }) // // Log at any level: // // logger.Info("server started", "port", 8080) // logger.Error("request failed", err, "path", "/users") // // Errors that implement ErrorCode() and ErrorContext() are automatically // enriched — the error code and context fields are added to the log record // without any extra method calls. This pairs naturally with xerrors.Err. // // Attach request context to a child logger: // // ctx = logz.WithRequestID(ctx, requestID) // ctx = logz.WithField(ctx, "user_id", userID) // reqLogger := logger.WithContext(ctx) // reqLogger.Info("handling request") package logz