github.com/blend/go-sdk@v1.20220411.3/examples/r2/logged/main.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package main 9 10 import ( 11 "fmt" 12 "os" 13 14 "github.com/blend/go-sdk/logger" 15 "github.com/blend/go-sdk/r2" 16 ) 17 18 func main() { 19 log := logger.MustNew(logger.OptAll()) 20 defer log.Close() 21 22 _, err := r2.New("https://google.com/robots.txt", 23 r2.OptHeaderValue("X-Sent-By", "go-sdk/request2"), 24 r2.OptCookieValue("r2-ray-id", "example-stringdog01"), 25 r2.OptLogResponse(log), 26 ).Discard() 27 28 if err != nil { 29 fmt.Fprintf(os.Stderr, "%v\n", err) 30 os.Exit(1) 31 } 32 }