planetscale 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +9 -1
- data/.github/workflows/gem-push.yml +9 -2
- data/.licenses/go/github.com/matoous/go-nanoid/v2.dep.yml +34 -0
- data/.licenses/go/github.com/planetscale/planetscale-go/planetscale.dep.yml +1 -1
- data/.licenses/go/github.com/planetscale/sql-proxy/proxy.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/buffer.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/bufferpool.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/color.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/internal/exit.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap/zapcore.dep.yml +1 -1
- data/.licenses/go/go.uber.org/zap.dep.yml +1 -1
- data/README.md +2 -0
- data/controller.go +21 -36
- data/go.mod +4 -3
- data/go.sum +32 -18
- data/lib/planetscale/version.rb +1 -1
- data/lib/planetscale.rb +2 -3
- data/planetscale.gemspec +1 -1
- data/proxy/planetscale-darwin.h +1 -1
- data/proxy/planetscale-darwin.so +0 -0
- data/proxy/planetscale-linux.h +1 -1
- data/proxy/planetscale-linux.so +0 -0
- data/proxy.go +1 -5
- metadata +3 -345
- data/vendor/github.com/armon/circbuf/.gitignore +0 -22
- data/vendor/github.com/armon/circbuf/LICENSE +0 -20
- data/vendor/github.com/armon/circbuf/README.md +0 -28
- data/vendor/github.com/armon/circbuf/circbuf.go +0 -92
- data/vendor/github.com/armon/circbuf/go.mod +0 -1
- data/vendor/github.com/golang/protobuf/AUTHORS +0 -3
- data/vendor/github.com/golang/protobuf/CONTRIBUTORS +0 -3
- data/vendor/github.com/golang/protobuf/LICENSE +0 -28
- data/vendor/github.com/golang/protobuf/proto/buffer.go +0 -324
- data/vendor/github.com/golang/protobuf/proto/defaults.go +0 -63
- data/vendor/github.com/golang/protobuf/proto/deprecated.go +0 -113
- data/vendor/github.com/golang/protobuf/proto/discard.go +0 -58
- data/vendor/github.com/golang/protobuf/proto/extensions.go +0 -356
- data/vendor/github.com/golang/protobuf/proto/properties.go +0 -306
- data/vendor/github.com/golang/protobuf/proto/proto.go +0 -167
- data/vendor/github.com/golang/protobuf/proto/registry.go +0 -317
- data/vendor/github.com/golang/protobuf/proto/text_decode.go +0 -801
- data/vendor/github.com/golang/protobuf/proto/text_encode.go +0 -560
- data/vendor/github.com/golang/protobuf/proto/wire.go +0 -78
- data/vendor/github.com/golang/protobuf/proto/wrappers.go +0 -34
- data/vendor/github.com/gorilla/mux/AUTHORS +0 -8
- data/vendor/github.com/gorilla/mux/LICENSE +0 -27
- data/vendor/github.com/gorilla/mux/README.md +0 -805
- data/vendor/github.com/gorilla/mux/doc.go +0 -306
- data/vendor/github.com/gorilla/mux/go.mod +0 -3
- data/vendor/github.com/gorilla/mux/middleware.go +0 -74
- data/vendor/github.com/gorilla/mux/mux.go +0 -606
- data/vendor/github.com/gorilla/mux/regexp.go +0 -388
- data/vendor/github.com/gorilla/mux/route.go +0 -736
- data/vendor/github.com/gorilla/mux/test_helpers.go +0 -19
- data/vendor/github.com/hashicorp/go-cleanhttp/LICENSE +0 -363
- data/vendor/github.com/hashicorp/go-cleanhttp/README.md +0 -30
- data/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go +0 -58
- data/vendor/github.com/hashicorp/go-cleanhttp/doc.go +0 -20
- data/vendor/github.com/hashicorp/go-cleanhttp/go.mod +0 -3
- data/vendor/github.com/hashicorp/go-cleanhttp/handlers.go +0 -48
- data/vendor/github.com/mitchellh/go-homedir/LICENSE +0 -21
- data/vendor/github.com/mitchellh/go-homedir/README.md +0 -14
- data/vendor/github.com/mitchellh/go-homedir/go.mod +0 -1
- data/vendor/github.com/mitchellh/go-homedir/homedir.go +0 -167
- data/vendor/github.com/pkg/errors/.gitignore +0 -24
- data/vendor/github.com/pkg/errors/.travis.yml +0 -10
- data/vendor/github.com/pkg/errors/LICENSE +0 -23
- data/vendor/github.com/pkg/errors/Makefile +0 -44
- data/vendor/github.com/pkg/errors/README.md +0 -59
- data/vendor/github.com/pkg/errors/appveyor.yml +0 -32
- data/vendor/github.com/pkg/errors/errors.go +0 -288
- data/vendor/github.com/pkg/errors/go113.go +0 -38
- data/vendor/github.com/pkg/errors/stack.go +0 -177
- data/vendor/github.com/planetscale/planetscale-go/LICENSE +0 -202
- data/vendor/github.com/planetscale/planetscale-go/planetscale/audit_logs.go +0 -136
- data/vendor/github.com/planetscale/planetscale-go/planetscale/backups.go +0 -139
- data/vendor/github.com/planetscale/planetscale-go/planetscale/branches.go +0 -252
- data/vendor/github.com/planetscale/planetscale-go/planetscale/certs.go +0 -166
- data/vendor/github.com/planetscale/planetscale-go/planetscale/client.go +0 -312
- data/vendor/github.com/planetscale/planetscale-go/planetscale/databases.go +0 -133
- data/vendor/github.com/planetscale/planetscale-go/planetscale/deploy_requests.go +0 -368
- data/vendor/github.com/planetscale/planetscale-go/planetscale/organizations.go +0 -103
- data/vendor/github.com/planetscale/planetscale-go/planetscale/regions.go +0 -52
- data/vendor/github.com/planetscale/planetscale-go/planetscale/service_tokens.go +0 -163
- data/vendor/github.com/planetscale/sql-proxy/LICENSE +0 -202
- data/vendor/github.com/planetscale/sql-proxy/proxy/client.go +0 -476
- data/vendor/github.com/planetscale/sql-proxy/proxy/tls_cache.go +0 -73
- data/vendor/go.uber.org/atomic/.codecov.yml +0 -19
- data/vendor/go.uber.org/atomic/.gitignore +0 -12
- data/vendor/go.uber.org/atomic/.travis.yml +0 -27
- data/vendor/go.uber.org/atomic/CHANGELOG.md +0 -76
- data/vendor/go.uber.org/atomic/LICENSE.txt +0 -19
- data/vendor/go.uber.org/atomic/Makefile +0 -78
- data/vendor/go.uber.org/atomic/README.md +0 -63
- data/vendor/go.uber.org/atomic/bool.go +0 -81
- data/vendor/go.uber.org/atomic/bool_ext.go +0 -53
- data/vendor/go.uber.org/atomic/doc.go +0 -23
- data/vendor/go.uber.org/atomic/duration.go +0 -82
- data/vendor/go.uber.org/atomic/duration_ext.go +0 -40
- data/vendor/go.uber.org/atomic/error.go +0 -51
- data/vendor/go.uber.org/atomic/error_ext.go +0 -39
- data/vendor/go.uber.org/atomic/float64.go +0 -76
- data/vendor/go.uber.org/atomic/float64_ext.go +0 -47
- data/vendor/go.uber.org/atomic/gen.go +0 -26
- data/vendor/go.uber.org/atomic/go.mod +0 -8
- data/vendor/go.uber.org/atomic/go.sum +0 -9
- data/vendor/go.uber.org/atomic/int32.go +0 -102
- data/vendor/go.uber.org/atomic/int64.go +0 -102
- data/vendor/go.uber.org/atomic/nocmp.go +0 -35
- data/vendor/go.uber.org/atomic/string.go +0 -54
- data/vendor/go.uber.org/atomic/string_ext.go +0 -43
- data/vendor/go.uber.org/atomic/uint32.go +0 -102
- data/vendor/go.uber.org/atomic/uint64.go +0 -102
- data/vendor/go.uber.org/atomic/value.go +0 -31
- data/vendor/go.uber.org/multierr/.codecov.yml +0 -15
- data/vendor/go.uber.org/multierr/.gitignore +0 -4
- data/vendor/go.uber.org/multierr/.travis.yml +0 -23
- data/vendor/go.uber.org/multierr/CHANGELOG.md +0 -60
- data/vendor/go.uber.org/multierr/LICENSE.txt +0 -19
- data/vendor/go.uber.org/multierr/Makefile +0 -42
- data/vendor/go.uber.org/multierr/README.md +0 -23
- data/vendor/go.uber.org/multierr/error.go +0 -449
- data/vendor/go.uber.org/multierr/glide.yaml +0 -8
- data/vendor/go.uber.org/multierr/go.mod +0 -8
- data/vendor/go.uber.org/multierr/go.sum +0 -11
- data/vendor/go.uber.org/multierr/go113.go +0 -52
- data/vendor/go.uber.org/zap/.codecov.yml +0 -17
- data/vendor/go.uber.org/zap/.gitignore +0 -32
- data/vendor/go.uber.org/zap/.readme.tmpl +0 -109
- data/vendor/go.uber.org/zap/CHANGELOG.md +0 -492
- data/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md +0 -75
- data/vendor/go.uber.org/zap/CONTRIBUTING.md +0 -75
- data/vendor/go.uber.org/zap/FAQ.md +0 -164
- data/vendor/go.uber.org/zap/LICENSE.txt +0 -19
- data/vendor/go.uber.org/zap/Makefile +0 -73
- data/vendor/go.uber.org/zap/README.md +0 -134
- data/vendor/go.uber.org/zap/array.go +0 -320
- data/vendor/go.uber.org/zap/buffer/buffer.go +0 -141
- data/vendor/go.uber.org/zap/buffer/pool.go +0 -49
- data/vendor/go.uber.org/zap/checklicense.sh +0 -17
- data/vendor/go.uber.org/zap/config.go +0 -264
- data/vendor/go.uber.org/zap/doc.go +0 -113
- data/vendor/go.uber.org/zap/encoder.go +0 -79
- data/vendor/go.uber.org/zap/error.go +0 -80
- data/vendor/go.uber.org/zap/field.go +0 -549
- data/vendor/go.uber.org/zap/flag.go +0 -39
- data/vendor/go.uber.org/zap/glide.yaml +0 -34
- data/vendor/go.uber.org/zap/global.go +0 -168
- data/vendor/go.uber.org/zap/global_go112.go +0 -26
- data/vendor/go.uber.org/zap/global_prego112.go +0 -26
- data/vendor/go.uber.org/zap/go.mod +0 -14
- data/vendor/go.uber.org/zap/go.sum +0 -54
- data/vendor/go.uber.org/zap/http_handler.go +0 -132
- data/vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go +0 -31
- data/vendor/go.uber.org/zap/internal/color/color.go +0 -44
- data/vendor/go.uber.org/zap/internal/exit/exit.go +0 -64
- data/vendor/go.uber.org/zap/level.go +0 -132
- data/vendor/go.uber.org/zap/logger.go +0 -348
- data/vendor/go.uber.org/zap/options.go +0 -148
- data/vendor/go.uber.org/zap/sink.go +0 -161
- data/vendor/go.uber.org/zap/stacktrace.go +0 -85
- data/vendor/go.uber.org/zap/sugar.go +0 -315
- data/vendor/go.uber.org/zap/time.go +0 -27
- data/vendor/go.uber.org/zap/writer.go +0 -99
- data/vendor/go.uber.org/zap/zapcore/buffered_write_syncer.go +0 -188
- data/vendor/go.uber.org/zap/zapcore/clock.go +0 -50
- data/vendor/go.uber.org/zap/zapcore/console_encoder.go +0 -161
- data/vendor/go.uber.org/zap/zapcore/core.go +0 -113
- data/vendor/go.uber.org/zap/zapcore/doc.go +0 -24
- data/vendor/go.uber.org/zap/zapcore/encoder.go +0 -443
- data/vendor/go.uber.org/zap/zapcore/entry.go +0 -264
- data/vendor/go.uber.org/zap/zapcore/error.go +0 -132
- data/vendor/go.uber.org/zap/zapcore/field.go +0 -233
- data/vendor/go.uber.org/zap/zapcore/hook.go +0 -68
- data/vendor/go.uber.org/zap/zapcore/increase_level.go +0 -66
- data/vendor/go.uber.org/zap/zapcore/json_encoder.go +0 -534
- data/vendor/go.uber.org/zap/zapcore/level.go +0 -175
- data/vendor/go.uber.org/zap/zapcore/level_strings.go +0 -46
- data/vendor/go.uber.org/zap/zapcore/marshaler.go +0 -61
- data/vendor/go.uber.org/zap/zapcore/memory_encoder.go +0 -179
- data/vendor/go.uber.org/zap/zapcore/sampler.go +0 -208
- data/vendor/go.uber.org/zap/zapcore/tee.go +0 -81
- data/vendor/go.uber.org/zap/zapcore/write_syncer.go +0 -122
- data/vendor/golang.org/x/net/AUTHORS +0 -3
- data/vendor/golang.org/x/net/CONTRIBUTORS +0 -3
- data/vendor/golang.org/x/net/LICENSE +0 -27
- data/vendor/golang.org/x/net/PATENTS +0 -22
- data/vendor/golang.org/x/net/context/context.go +0 -56
- data/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go +0 -71
- data/vendor/golang.org/x/net/context/go17.go +0 -73
- data/vendor/golang.org/x/net/context/go19.go +0 -21
- data/vendor/golang.org/x/net/context/pre_go17.go +0 -301
- data/vendor/golang.org/x/net/context/pre_go19.go +0 -110
- data/vendor/golang.org/x/oauth2/.travis.yml +0 -13
- data/vendor/golang.org/x/oauth2/AUTHORS +0 -3
- data/vendor/golang.org/x/oauth2/CONTRIBUTING.md +0 -26
- data/vendor/golang.org/x/oauth2/CONTRIBUTORS +0 -3
- data/vendor/golang.org/x/oauth2/LICENSE +0 -27
- data/vendor/golang.org/x/oauth2/README.md +0 -36
- data/vendor/golang.org/x/oauth2/go.mod +0 -9
- data/vendor/golang.org/x/oauth2/go.sum +0 -361
- data/vendor/golang.org/x/oauth2/internal/client_appengine.go +0 -14
- data/vendor/golang.org/x/oauth2/internal/doc.go +0 -6
- data/vendor/golang.org/x/oauth2/internal/oauth2.go +0 -37
- data/vendor/golang.org/x/oauth2/internal/token.go +0 -294
- data/vendor/golang.org/x/oauth2/internal/transport.go +0 -33
- data/vendor/golang.org/x/oauth2/oauth2.go +0 -381
- data/vendor/golang.org/x/oauth2/token.go +0 -178
- data/vendor/golang.org/x/oauth2/transport.go +0 -89
- data/vendor/google.golang.org/appengine/LICENSE +0 -202
- data/vendor/google.golang.org/appengine/internal/api.go +0 -678
- data/vendor/google.golang.org/appengine/internal/api_classic.go +0 -169
- data/vendor/google.golang.org/appengine/internal/api_common.go +0 -123
- data/vendor/google.golang.org/appengine/internal/app_id.go +0 -28
- data/vendor/google.golang.org/appengine/internal/base/api_base.pb.go +0 -308
- data/vendor/google.golang.org/appengine/internal/base/api_base.proto +0 -33
- data/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.pb.go +0 -4367
- data/vendor/google.golang.org/appengine/internal/datastore/datastore_v3.proto +0 -551
- data/vendor/google.golang.org/appengine/internal/identity.go +0 -55
- data/vendor/google.golang.org/appengine/internal/identity_classic.go +0 -61
- data/vendor/google.golang.org/appengine/internal/identity_flex.go +0 -11
- data/vendor/google.golang.org/appengine/internal/identity_vm.go +0 -134
- data/vendor/google.golang.org/appengine/internal/internal.go +0 -110
- data/vendor/google.golang.org/appengine/internal/log/log_service.pb.go +0 -1313
- data/vendor/google.golang.org/appengine/internal/log/log_service.proto +0 -150
- data/vendor/google.golang.org/appengine/internal/main.go +0 -16
- data/vendor/google.golang.org/appengine/internal/main_common.go +0 -7
- data/vendor/google.golang.org/appengine/internal/main_vm.go +0 -69
- data/vendor/google.golang.org/appengine/internal/metadata.go +0 -60
- data/vendor/google.golang.org/appengine/internal/net.go +0 -56
- data/vendor/google.golang.org/appengine/internal/regen.sh +0 -40
- data/vendor/google.golang.org/appengine/internal/remote_api/remote_api.pb.go +0 -361
- data/vendor/google.golang.org/appengine/internal/remote_api/remote_api.proto +0 -44
- data/vendor/google.golang.org/appengine/internal/transaction.go +0 -115
- data/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.pb.go +0 -527
- data/vendor/google.golang.org/appengine/internal/urlfetch/urlfetch_service.proto +0 -64
- data/vendor/google.golang.org/appengine/urlfetch/urlfetch.go +0 -210
- data/vendor/google.golang.org/protobuf/AUTHORS +0 -3
- data/vendor/google.golang.org/protobuf/CONTRIBUTORS +0 -3
- data/vendor/google.golang.org/protobuf/LICENSE +0 -27
- data/vendor/google.golang.org/protobuf/PATENTS +0 -22
- data/vendor/google.golang.org/protobuf/encoding/prototext/decode.go +0 -773
- data/vendor/google.golang.org/protobuf/encoding/prototext/doc.go +0 -7
- data/vendor/google.golang.org/protobuf/encoding/prototext/encode.go +0 -371
- data/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +0 -538
- data/vendor/google.golang.org/protobuf/internal/descfmt/stringer.go +0 -318
- data/vendor/google.golang.org/protobuf/internal/descopts/options.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/detrand/rand.go +0 -69
- data/vendor/google.golang.org/protobuf/internal/encoding/defval/default.go +0 -213
- data/vendor/google.golang.org/protobuf/internal/encoding/messageset/messageset.go +0 -241
- data/vendor/google.golang.org/protobuf/internal/encoding/tag/tag.go +0 -207
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode.go +0 -665
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_number.go +0 -190
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_string.go +0 -161
- data/vendor/google.golang.org/protobuf/internal/encoding/text/decode_token.go +0 -373
- data/vendor/google.golang.org/protobuf/internal/encoding/text/doc.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go +0 -265
- data/vendor/google.golang.org/protobuf/internal/errors/errors.go +0 -89
- data/vendor/google.golang.org/protobuf/internal/errors/is_go112.go +0 -39
- data/vendor/google.golang.org/protobuf/internal/errors/is_go113.go +0 -12
- data/vendor/google.golang.org/protobuf/internal/filedesc/build.go +0 -158
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +0 -631
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +0 -471
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +0 -704
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_list.go +0 -450
- data/vendor/google.golang.org/protobuf/internal/filedesc/desc_list_gen.go +0 -356
- data/vendor/google.golang.org/protobuf/internal/filedesc/placeholder.go +0 -107
- data/vendor/google.golang.org/protobuf/internal/filetype/build.go +0 -297
- data/vendor/google.golang.org/protobuf/internal/flags/flags.go +0 -24
- data/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_disable.go +0 -9
- data/vendor/google.golang.org/protobuf/internal/flags/proto_legacy_enable.go +0 -9
- data/vendor/google.golang.org/protobuf/internal/genid/any_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +0 -106
- data/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +0 -829
- data/vendor/google.golang.org/protobuf/internal/genid/doc.go +0 -11
- data/vendor/google.golang.org/protobuf/internal/genid/duration_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/empty_gen.go +0 -19
- data/vendor/google.golang.org/protobuf/internal/genid/field_mask_gen.go +0 -31
- data/vendor/google.golang.org/protobuf/internal/genid/goname.go +0 -25
- data/vendor/google.golang.org/protobuf/internal/genid/map_entry.go +0 -16
- data/vendor/google.golang.org/protobuf/internal/genid/source_context_gen.go +0 -31
- data/vendor/google.golang.org/protobuf/internal/genid/struct_gen.go +0 -116
- data/vendor/google.golang.org/protobuf/internal/genid/timestamp_gen.go +0 -34
- data/vendor/google.golang.org/protobuf/internal/genid/type_gen.go +0 -184
- data/vendor/google.golang.org/protobuf/internal/genid/wrappers.go +0 -13
- data/vendor/google.golang.org/protobuf/internal/genid/wrappers_gen.go +0 -175
- data/vendor/google.golang.org/protobuf/internal/impl/api_export.go +0 -177
- data/vendor/google.golang.org/protobuf/internal/impl/checkinit.go +0 -141
- data/vendor/google.golang.org/protobuf/internal/impl/codec_extension.go +0 -223
- data/vendor/google.golang.org/protobuf/internal/impl/codec_field.go +0 -830
- data/vendor/google.golang.org/protobuf/internal/impl/codec_gen.go +0 -5637
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map.go +0 -388
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map_go111.go +0 -37
- data/vendor/google.golang.org/protobuf/internal/impl/codec_map_go112.go +0 -11
- data/vendor/google.golang.org/protobuf/internal/impl/codec_message.go +0 -217
- data/vendor/google.golang.org/protobuf/internal/impl/codec_messageset.go +0 -123
- data/vendor/google.golang.org/protobuf/internal/impl/codec_reflect.go +0 -209
- data/vendor/google.golang.org/protobuf/internal/impl/codec_tables.go +0 -557
- data/vendor/google.golang.org/protobuf/internal/impl/codec_unsafe.go +0 -17
- data/vendor/google.golang.org/protobuf/internal/impl/convert.go +0 -496
- data/vendor/google.golang.org/protobuf/internal/impl/convert_list.go +0 -141
- data/vendor/google.golang.org/protobuf/internal/impl/convert_map.go +0 -121
- data/vendor/google.golang.org/protobuf/internal/impl/decode.go +0 -276
- data/vendor/google.golang.org/protobuf/internal/impl/encode.go +0 -201
- data/vendor/google.golang.org/protobuf/internal/impl/enum.go +0 -21
- data/vendor/google.golang.org/protobuf/internal/impl/extension.go +0 -156
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_enum.go +0 -219
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_export.go +0 -92
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_extension.go +0 -176
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_file.go +0 -81
- data/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go +0 -558
- data/vendor/google.golang.org/protobuf/internal/impl/merge.go +0 -176
- data/vendor/google.golang.org/protobuf/internal/impl/merge_gen.go +0 -209
- data/vendor/google.golang.org/protobuf/internal/impl/message.go +0 -276
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect.go +0 -465
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect_field.go +0 -543
- data/vendor/google.golang.org/protobuf/internal/impl/message_reflect_gen.go +0 -249
- data/vendor/google.golang.org/protobuf/internal/impl/pointer_reflect.go +0 -178
- data/vendor/google.golang.org/protobuf/internal/impl/pointer_unsafe.go +0 -174
- data/vendor/google.golang.org/protobuf/internal/impl/validate.go +0 -576
- data/vendor/google.golang.org/protobuf/internal/impl/weak.go +0 -74
- data/vendor/google.golang.org/protobuf/internal/order/order.go +0 -89
- data/vendor/google.golang.org/protobuf/internal/order/range.go +0 -115
- data/vendor/google.golang.org/protobuf/internal/pragma/pragma.go +0 -29
- data/vendor/google.golang.org/protobuf/internal/set/ints.go +0 -58
- data/vendor/google.golang.org/protobuf/internal/strs/strings.go +0 -196
- data/vendor/google.golang.org/protobuf/internal/strs/strings_pure.go +0 -27
- data/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe.go +0 -94
- data/vendor/google.golang.org/protobuf/internal/version/version.go +0 -79
- data/vendor/google.golang.org/protobuf/proto/checkinit.go +0 -71
- data/vendor/google.golang.org/protobuf/proto/decode.go +0 -278
- data/vendor/google.golang.org/protobuf/proto/decode_gen.go +0 -603
- data/vendor/google.golang.org/protobuf/proto/doc.go +0 -94
- data/vendor/google.golang.org/protobuf/proto/encode.go +0 -319
- data/vendor/google.golang.org/protobuf/proto/encode_gen.go +0 -97
- data/vendor/google.golang.org/protobuf/proto/equal.go +0 -167
- data/vendor/google.golang.org/protobuf/proto/extension.go +0 -92
- data/vendor/google.golang.org/protobuf/proto/merge.go +0 -139
- data/vendor/google.golang.org/protobuf/proto/messageset.go +0 -93
- data/vendor/google.golang.org/protobuf/proto/proto.go +0 -43
- data/vendor/google.golang.org/protobuf/proto/proto_methods.go +0 -19
- data/vendor/google.golang.org/protobuf/proto/proto_reflect.go +0 -19
- data/vendor/google.golang.org/protobuf/proto/reset.go +0 -43
- data/vendor/google.golang.org/protobuf/proto/size.go +0 -97
- data/vendor/google.golang.org/protobuf/proto/size_gen.go +0 -55
- data/vendor/google.golang.org/protobuf/proto/wrappers.go +0 -29
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc.go +0 -276
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_init.go +0 -248
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_resolve.go +0 -286
- data/vendor/google.golang.org/protobuf/reflect/protodesc/desc_validate.go +0 -374
- data/vendor/google.golang.org/protobuf/reflect/protodesc/proto.go +0 -252
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/methods.go +0 -77
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/proto.go +0 -504
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/source.go +0 -128
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +0 -461
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/type.go +0 -665
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value.go +0 -285
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_pure.go +0 -59
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_union.go +0 -411
- data/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe.go +0 -98
- data/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go +0 -869
- data/vendor/google.golang.org/protobuf/runtime/protoiface/legacy.go +0 -15
- data/vendor/google.golang.org/protobuf/runtime/protoiface/methods.go +0 -167
- data/vendor/google.golang.org/protobuf/runtime/protoimpl/impl.go +0 -44
- data/vendor/google.golang.org/protobuf/runtime/protoimpl/version.go +0 -56
- data/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go +0 -4039
- data/vendor/modules.txt +0 -79
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
package zapcore
|
|
22
|
-
|
|
23
|
-
import (
|
|
24
|
-
"fmt"
|
|
25
|
-
"reflect"
|
|
26
|
-
"sync"
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
// Encodes the given error into fields of an object. A field with the given
|
|
30
|
-
// name is added for the error message.
|
|
31
|
-
//
|
|
32
|
-
// If the error implements fmt.Formatter, a field with the name ${key}Verbose
|
|
33
|
-
// is also added with the full verbose error message.
|
|
34
|
-
//
|
|
35
|
-
// Finally, if the error implements errorGroup (from go.uber.org/multierr) or
|
|
36
|
-
// causer (from github.com/pkg/errors), a ${key}Causes field is added with an
|
|
37
|
-
// array of objects containing the errors this error was comprised of.
|
|
38
|
-
//
|
|
39
|
-
// {
|
|
40
|
-
// "error": err.Error(),
|
|
41
|
-
// "errorVerbose": fmt.Sprintf("%+v", err),
|
|
42
|
-
// "errorCauses": [
|
|
43
|
-
// ...
|
|
44
|
-
// ],
|
|
45
|
-
// }
|
|
46
|
-
func encodeError(key string, err error, enc ObjectEncoder) (retErr error) {
|
|
47
|
-
// Try to capture panics (from nil references or otherwise) when calling
|
|
48
|
-
// the Error() method
|
|
49
|
-
defer func() {
|
|
50
|
-
if rerr := recover(); rerr != nil {
|
|
51
|
-
// If it's a nil pointer, just say "<nil>". The likeliest causes are a
|
|
52
|
-
// error that fails to guard against nil or a nil pointer for a
|
|
53
|
-
// value receiver, and in either case, "<nil>" is a nice result.
|
|
54
|
-
if v := reflect.ValueOf(err); v.Kind() == reflect.Ptr && v.IsNil() {
|
|
55
|
-
enc.AddString(key, "<nil>")
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
retErr = fmt.Errorf("PANIC=%v", rerr)
|
|
60
|
-
}
|
|
61
|
-
}()
|
|
62
|
-
|
|
63
|
-
basic := err.Error()
|
|
64
|
-
enc.AddString(key, basic)
|
|
65
|
-
|
|
66
|
-
switch e := err.(type) {
|
|
67
|
-
case errorGroup:
|
|
68
|
-
return enc.AddArray(key+"Causes", errArray(e.Errors()))
|
|
69
|
-
case fmt.Formatter:
|
|
70
|
-
verbose := fmt.Sprintf("%+v", e)
|
|
71
|
-
if verbose != basic {
|
|
72
|
-
// This is a rich error type, like those produced by
|
|
73
|
-
// github.com/pkg/errors.
|
|
74
|
-
enc.AddString(key+"Verbose", verbose)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return nil
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
type errorGroup interface {
|
|
81
|
-
// Provides read-only access to the underlying list of errors, preferably
|
|
82
|
-
// without causing any allocs.
|
|
83
|
-
Errors() []error
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Note that errArry and errArrayElem are very similar to the version
|
|
87
|
-
// implemented in the top-level error.go file. We can't re-use this because
|
|
88
|
-
// that would require exporting errArray as part of the zapcore API.
|
|
89
|
-
|
|
90
|
-
// Encodes a list of errors using the standard error encoding logic.
|
|
91
|
-
type errArray []error
|
|
92
|
-
|
|
93
|
-
func (errs errArray) MarshalLogArray(arr ArrayEncoder) error {
|
|
94
|
-
for i := range errs {
|
|
95
|
-
if errs[i] == nil {
|
|
96
|
-
continue
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
el := newErrArrayElem(errs[i])
|
|
100
|
-
arr.AppendObject(el)
|
|
101
|
-
el.Free()
|
|
102
|
-
}
|
|
103
|
-
return nil
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
var _errArrayElemPool = sync.Pool{New: func() interface{} {
|
|
107
|
-
return &errArrayElem{}
|
|
108
|
-
}}
|
|
109
|
-
|
|
110
|
-
// Encodes any error into a {"error": ...} re-using the same errors logic.
|
|
111
|
-
//
|
|
112
|
-
// May be passed in place of an array to build a single-element array.
|
|
113
|
-
type errArrayElem struct{ err error }
|
|
114
|
-
|
|
115
|
-
func newErrArrayElem(err error) *errArrayElem {
|
|
116
|
-
e := _errArrayElemPool.Get().(*errArrayElem)
|
|
117
|
-
e.err = err
|
|
118
|
-
return e
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
func (e *errArrayElem) MarshalLogArray(arr ArrayEncoder) error {
|
|
122
|
-
return arr.AppendObject(e)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
func (e *errArrayElem) MarshalLogObject(enc ObjectEncoder) error {
|
|
126
|
-
return encodeError("error", e.err, enc)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
func (e *errArrayElem) Free() {
|
|
130
|
-
e.err = nil
|
|
131
|
-
_errArrayElemPool.Put(e)
|
|
132
|
-
}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2016 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
package zapcore
|
|
22
|
-
|
|
23
|
-
import (
|
|
24
|
-
"bytes"
|
|
25
|
-
"fmt"
|
|
26
|
-
"math"
|
|
27
|
-
"reflect"
|
|
28
|
-
"time"
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
// A FieldType indicates which member of the Field union struct should be used
|
|
32
|
-
// and how it should be serialized.
|
|
33
|
-
type FieldType uint8
|
|
34
|
-
|
|
35
|
-
const (
|
|
36
|
-
// UnknownType is the default field type. Attempting to add it to an encoder will panic.
|
|
37
|
-
UnknownType FieldType = iota
|
|
38
|
-
// ArrayMarshalerType indicates that the field carries an ArrayMarshaler.
|
|
39
|
-
ArrayMarshalerType
|
|
40
|
-
// ObjectMarshalerType indicates that the field carries an ObjectMarshaler.
|
|
41
|
-
ObjectMarshalerType
|
|
42
|
-
// BinaryType indicates that the field carries an opaque binary blob.
|
|
43
|
-
BinaryType
|
|
44
|
-
// BoolType indicates that the field carries a bool.
|
|
45
|
-
BoolType
|
|
46
|
-
// ByteStringType indicates that the field carries UTF-8 encoded bytes.
|
|
47
|
-
ByteStringType
|
|
48
|
-
// Complex128Type indicates that the field carries a complex128.
|
|
49
|
-
Complex128Type
|
|
50
|
-
// Complex64Type indicates that the field carries a complex128.
|
|
51
|
-
Complex64Type
|
|
52
|
-
// DurationType indicates that the field carries a time.Duration.
|
|
53
|
-
DurationType
|
|
54
|
-
// Float64Type indicates that the field carries a float64.
|
|
55
|
-
Float64Type
|
|
56
|
-
// Float32Type indicates that the field carries a float32.
|
|
57
|
-
Float32Type
|
|
58
|
-
// Int64Type indicates that the field carries an int64.
|
|
59
|
-
Int64Type
|
|
60
|
-
// Int32Type indicates that the field carries an int32.
|
|
61
|
-
Int32Type
|
|
62
|
-
// Int16Type indicates that the field carries an int16.
|
|
63
|
-
Int16Type
|
|
64
|
-
// Int8Type indicates that the field carries an int8.
|
|
65
|
-
Int8Type
|
|
66
|
-
// StringType indicates that the field carries a string.
|
|
67
|
-
StringType
|
|
68
|
-
// TimeType indicates that the field carries a time.Time that is
|
|
69
|
-
// representable by a UnixNano() stored as an int64.
|
|
70
|
-
TimeType
|
|
71
|
-
// TimeFullType indicates that the field carries a time.Time stored as-is.
|
|
72
|
-
TimeFullType
|
|
73
|
-
// Uint64Type indicates that the field carries a uint64.
|
|
74
|
-
Uint64Type
|
|
75
|
-
// Uint32Type indicates that the field carries a uint32.
|
|
76
|
-
Uint32Type
|
|
77
|
-
// Uint16Type indicates that the field carries a uint16.
|
|
78
|
-
Uint16Type
|
|
79
|
-
// Uint8Type indicates that the field carries a uint8.
|
|
80
|
-
Uint8Type
|
|
81
|
-
// UintptrType indicates that the field carries a uintptr.
|
|
82
|
-
UintptrType
|
|
83
|
-
// ReflectType indicates that the field carries an interface{}, which should
|
|
84
|
-
// be serialized using reflection.
|
|
85
|
-
ReflectType
|
|
86
|
-
// NamespaceType signals the beginning of an isolated namespace. All
|
|
87
|
-
// subsequent fields should be added to the new namespace.
|
|
88
|
-
NamespaceType
|
|
89
|
-
// StringerType indicates that the field carries a fmt.Stringer.
|
|
90
|
-
StringerType
|
|
91
|
-
// ErrorType indicates that the field carries an error.
|
|
92
|
-
ErrorType
|
|
93
|
-
// SkipType indicates that the field is a no-op.
|
|
94
|
-
SkipType
|
|
95
|
-
|
|
96
|
-
// InlineMarshalerType indicates that the field carries an ObjectMarshaler
|
|
97
|
-
// that should be inlined.
|
|
98
|
-
InlineMarshalerType
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
// A Field is a marshaling operation used to add a key-value pair to a logger's
|
|
102
|
-
// context. Most fields are lazily marshaled, so it's inexpensive to add fields
|
|
103
|
-
// to disabled debug-level log statements.
|
|
104
|
-
type Field struct {
|
|
105
|
-
Key string
|
|
106
|
-
Type FieldType
|
|
107
|
-
Integer int64
|
|
108
|
-
String string
|
|
109
|
-
Interface interface{}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// AddTo exports a field through the ObjectEncoder interface. It's primarily
|
|
113
|
-
// useful to library authors, and shouldn't be necessary in most applications.
|
|
114
|
-
func (f Field) AddTo(enc ObjectEncoder) {
|
|
115
|
-
var err error
|
|
116
|
-
|
|
117
|
-
switch f.Type {
|
|
118
|
-
case ArrayMarshalerType:
|
|
119
|
-
err = enc.AddArray(f.Key, f.Interface.(ArrayMarshaler))
|
|
120
|
-
case ObjectMarshalerType:
|
|
121
|
-
err = enc.AddObject(f.Key, f.Interface.(ObjectMarshaler))
|
|
122
|
-
case InlineMarshalerType:
|
|
123
|
-
err = f.Interface.(ObjectMarshaler).MarshalLogObject(enc)
|
|
124
|
-
case BinaryType:
|
|
125
|
-
enc.AddBinary(f.Key, f.Interface.([]byte))
|
|
126
|
-
case BoolType:
|
|
127
|
-
enc.AddBool(f.Key, f.Integer == 1)
|
|
128
|
-
case ByteStringType:
|
|
129
|
-
enc.AddByteString(f.Key, f.Interface.([]byte))
|
|
130
|
-
case Complex128Type:
|
|
131
|
-
enc.AddComplex128(f.Key, f.Interface.(complex128))
|
|
132
|
-
case Complex64Type:
|
|
133
|
-
enc.AddComplex64(f.Key, f.Interface.(complex64))
|
|
134
|
-
case DurationType:
|
|
135
|
-
enc.AddDuration(f.Key, time.Duration(f.Integer))
|
|
136
|
-
case Float64Type:
|
|
137
|
-
enc.AddFloat64(f.Key, math.Float64frombits(uint64(f.Integer)))
|
|
138
|
-
case Float32Type:
|
|
139
|
-
enc.AddFloat32(f.Key, math.Float32frombits(uint32(f.Integer)))
|
|
140
|
-
case Int64Type:
|
|
141
|
-
enc.AddInt64(f.Key, f.Integer)
|
|
142
|
-
case Int32Type:
|
|
143
|
-
enc.AddInt32(f.Key, int32(f.Integer))
|
|
144
|
-
case Int16Type:
|
|
145
|
-
enc.AddInt16(f.Key, int16(f.Integer))
|
|
146
|
-
case Int8Type:
|
|
147
|
-
enc.AddInt8(f.Key, int8(f.Integer))
|
|
148
|
-
case StringType:
|
|
149
|
-
enc.AddString(f.Key, f.String)
|
|
150
|
-
case TimeType:
|
|
151
|
-
if f.Interface != nil {
|
|
152
|
-
enc.AddTime(f.Key, time.Unix(0, f.Integer).In(f.Interface.(*time.Location)))
|
|
153
|
-
} else {
|
|
154
|
-
// Fall back to UTC if location is nil.
|
|
155
|
-
enc.AddTime(f.Key, time.Unix(0, f.Integer))
|
|
156
|
-
}
|
|
157
|
-
case TimeFullType:
|
|
158
|
-
enc.AddTime(f.Key, f.Interface.(time.Time))
|
|
159
|
-
case Uint64Type:
|
|
160
|
-
enc.AddUint64(f.Key, uint64(f.Integer))
|
|
161
|
-
case Uint32Type:
|
|
162
|
-
enc.AddUint32(f.Key, uint32(f.Integer))
|
|
163
|
-
case Uint16Type:
|
|
164
|
-
enc.AddUint16(f.Key, uint16(f.Integer))
|
|
165
|
-
case Uint8Type:
|
|
166
|
-
enc.AddUint8(f.Key, uint8(f.Integer))
|
|
167
|
-
case UintptrType:
|
|
168
|
-
enc.AddUintptr(f.Key, uintptr(f.Integer))
|
|
169
|
-
case ReflectType:
|
|
170
|
-
err = enc.AddReflected(f.Key, f.Interface)
|
|
171
|
-
case NamespaceType:
|
|
172
|
-
enc.OpenNamespace(f.Key)
|
|
173
|
-
case StringerType:
|
|
174
|
-
err = encodeStringer(f.Key, f.Interface, enc)
|
|
175
|
-
case ErrorType:
|
|
176
|
-
err = encodeError(f.Key, f.Interface.(error), enc)
|
|
177
|
-
case SkipType:
|
|
178
|
-
break
|
|
179
|
-
default:
|
|
180
|
-
panic(fmt.Sprintf("unknown field type: %v", f))
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if err != nil {
|
|
184
|
-
enc.AddString(fmt.Sprintf("%sError", f.Key), err.Error())
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Equals returns whether two fields are equal. For non-primitive types such as
|
|
189
|
-
// errors, marshalers, or reflect types, it uses reflect.DeepEqual.
|
|
190
|
-
func (f Field) Equals(other Field) bool {
|
|
191
|
-
if f.Type != other.Type {
|
|
192
|
-
return false
|
|
193
|
-
}
|
|
194
|
-
if f.Key != other.Key {
|
|
195
|
-
return false
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
switch f.Type {
|
|
199
|
-
case BinaryType, ByteStringType:
|
|
200
|
-
return bytes.Equal(f.Interface.([]byte), other.Interface.([]byte))
|
|
201
|
-
case ArrayMarshalerType, ObjectMarshalerType, ErrorType, ReflectType:
|
|
202
|
-
return reflect.DeepEqual(f.Interface, other.Interface)
|
|
203
|
-
default:
|
|
204
|
-
return f == other
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
func addFields(enc ObjectEncoder, fields []Field) {
|
|
209
|
-
for i := range fields {
|
|
210
|
-
fields[i].AddTo(enc)
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
func encodeStringer(key string, stringer interface{}, enc ObjectEncoder) (retErr error) {
|
|
215
|
-
// Try to capture panics (from nil references or otherwise) when calling
|
|
216
|
-
// the String() method, similar to https://golang.org/src/fmt/print.go#L540
|
|
217
|
-
defer func() {
|
|
218
|
-
if err := recover(); err != nil {
|
|
219
|
-
// If it's a nil pointer, just say "<nil>". The likeliest causes are a
|
|
220
|
-
// Stringer that fails to guard against nil or a nil pointer for a
|
|
221
|
-
// value receiver, and in either case, "<nil>" is a nice result.
|
|
222
|
-
if v := reflect.ValueOf(stringer); v.Kind() == reflect.Ptr && v.IsNil() {
|
|
223
|
-
enc.AddString(key, "<nil>")
|
|
224
|
-
return
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
retErr = fmt.Errorf("PANIC=%v", err)
|
|
228
|
-
}
|
|
229
|
-
}()
|
|
230
|
-
|
|
231
|
-
enc.AddString(key, stringer.(fmt.Stringer).String())
|
|
232
|
-
return nil
|
|
233
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2016 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
package zapcore
|
|
22
|
-
|
|
23
|
-
import "go.uber.org/multierr"
|
|
24
|
-
|
|
25
|
-
type hooked struct {
|
|
26
|
-
Core
|
|
27
|
-
funcs []func(Entry) error
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// RegisterHooks wraps a Core and runs a collection of user-defined callback
|
|
31
|
-
// hooks each time a message is logged. Execution of the callbacks is blocking.
|
|
32
|
-
//
|
|
33
|
-
// This offers users an easy way to register simple callbacks (e.g., metrics
|
|
34
|
-
// collection) without implementing the full Core interface.
|
|
35
|
-
func RegisterHooks(core Core, hooks ...func(Entry) error) Core {
|
|
36
|
-
funcs := append([]func(Entry) error{}, hooks...)
|
|
37
|
-
return &hooked{
|
|
38
|
-
Core: core,
|
|
39
|
-
funcs: funcs,
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
func (h *hooked) Check(ent Entry, ce *CheckedEntry) *CheckedEntry {
|
|
44
|
-
// Let the wrapped Core decide whether to log this message or not. This
|
|
45
|
-
// also gives the downstream a chance to register itself directly with the
|
|
46
|
-
// CheckedEntry.
|
|
47
|
-
if downstream := h.Core.Check(ent, ce); downstream != nil {
|
|
48
|
-
return downstream.AddCore(ent, h)
|
|
49
|
-
}
|
|
50
|
-
return ce
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
func (h *hooked) With(fields []Field) Core {
|
|
54
|
-
return &hooked{
|
|
55
|
-
Core: h.Core.With(fields),
|
|
56
|
-
funcs: h.funcs,
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
func (h *hooked) Write(ent Entry, _ []Field) error {
|
|
61
|
-
// Since our downstream had a chance to register itself directly with the
|
|
62
|
-
// CheckedMessage, we don't need to call it here.
|
|
63
|
-
var err error
|
|
64
|
-
for i := range h.funcs {
|
|
65
|
-
err = multierr.Append(err, h.funcs[i](ent))
|
|
66
|
-
}
|
|
67
|
-
return err
|
|
68
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2020 Uber Technologies, Inc.
|
|
2
|
-
//
|
|
3
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
// in the Software without restriction, including without limitation the rights
|
|
6
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
// furnished to do so, subject to the following conditions:
|
|
9
|
-
//
|
|
10
|
-
// The above copyright notice and this permission notice shall be included in
|
|
11
|
-
// all copies or substantial portions of the Software.
|
|
12
|
-
//
|
|
13
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
// THE SOFTWARE.
|
|
20
|
-
|
|
21
|
-
package zapcore
|
|
22
|
-
|
|
23
|
-
import "fmt"
|
|
24
|
-
|
|
25
|
-
type levelFilterCore struct {
|
|
26
|
-
core Core
|
|
27
|
-
level LevelEnabler
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// NewIncreaseLevelCore creates a core that can be used to increase the level of
|
|
31
|
-
// an existing Core. It cannot be used to decrease the logging level, as it acts
|
|
32
|
-
// as a filter before calling the underlying core. If level decreases the log level,
|
|
33
|
-
// an error is returned.
|
|
34
|
-
func NewIncreaseLevelCore(core Core, level LevelEnabler) (Core, error) {
|
|
35
|
-
for l := _maxLevel; l >= _minLevel; l-- {
|
|
36
|
-
if !core.Enabled(l) && level.Enabled(l) {
|
|
37
|
-
return nil, fmt.Errorf("invalid increase level, as level %q is allowed by increased level, but not by existing core", l)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return &levelFilterCore{core, level}, nil
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
func (c *levelFilterCore) Enabled(lvl Level) bool {
|
|
45
|
-
return c.level.Enabled(lvl)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
func (c *levelFilterCore) With(fields []Field) Core {
|
|
49
|
-
return &levelFilterCore{c.core.With(fields), c.level}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
func (c *levelFilterCore) Check(ent Entry, ce *CheckedEntry) *CheckedEntry {
|
|
53
|
-
if !c.Enabled(ent.Level) {
|
|
54
|
-
return ce
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return c.core.Check(ent, ce)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
func (c *levelFilterCore) Write(ent Entry, fields []Field) error {
|
|
61
|
-
return c.core.Write(ent, fields)
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
func (c *levelFilterCore) Sync() error {
|
|
65
|
-
return c.core.Sync()
|
|
66
|
-
}
|