planetscale 0.2.0 → 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/.buildkite/pipeline.yml +21 -0
- 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 +56 -3
- data/.licenses/go/github.com/planetscale/sql-proxy/proxy.dep.yml +205 -172
- 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 +11 -8
- data/controller.go +24 -26
- data/go.mod +4 -3
- data/go.sum +42 -27
- data/lib/generators/planetscale/install_generator.rb +8 -6
- data/lib/planetscale/version.rb +1 -1
- data/lib/planetscale.rb +14 -15
- data/planetscale.gemspec +2 -2
- 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 +6 -342
- 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/planetscale/backups.go +0 -139
- data/vendor/github.com/planetscale/planetscale-go/planetscale/branches.go +0 -258
- data/vendor/github.com/planetscale/planetscale-go/planetscale/certs.go +0 -142
- data/vendor/github.com/planetscale/planetscale-go/planetscale/client.go +0 -305
- data/vendor/github.com/planetscale/planetscale-go/planetscale/databases.go +0 -131
- data/vendor/github.com/planetscale/planetscale-go/planetscale/deploy_requests.go +0 -368
- data/vendor/github.com/planetscale/planetscale-go/planetscale/organizations.go +0 -78
- data/vendor/github.com/planetscale/planetscale-go/planetscale/service_tokens.go +0 -163
- data/vendor/github.com/planetscale/sql-proxy/proxy/client.go +0 -467
- 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/.travis.yml +0 -23
- data/vendor/go.uber.org/zap/CHANGELOG.md +0 -432
- data/vendor/go.uber.org/zap/CODE_OF_CONDUCT.md +0 -75
- data/vendor/go.uber.org/zap/CONTRIBUTING.md +0 -81
- data/vendor/go.uber.org/zap/FAQ.md +0 -156
- data/vendor/go.uber.org/zap/LICENSE.txt +0 -19
- data/vendor/go.uber.org/zap/Makefile +0 -63
- 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 -123
- 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 -539
- 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 -13
- data/vendor/go.uber.org/zap/go.sum +0 -56
- data/vendor/go.uber.org/zap/http_handler.go +0 -81
- 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 -344
- data/vendor/go.uber.org/zap/options.go +0 -140
- 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 -304
- 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/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 -115
- data/vendor/go.uber.org/zap/zapcore/field.go +0 -227
- 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 -123
- 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,168 +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 zap
|
|
22
|
-
|
|
23
|
-
import (
|
|
24
|
-
"bytes"
|
|
25
|
-
"fmt"
|
|
26
|
-
"log"
|
|
27
|
-
"os"
|
|
28
|
-
"sync"
|
|
29
|
-
|
|
30
|
-
"go.uber.org/zap/zapcore"
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
const (
|
|
34
|
-
_loggerWriterDepth = 2
|
|
35
|
-
_programmerErrorTemplate = "You've found a bug in zap! Please file a bug at " +
|
|
36
|
-
"https://github.com/uber-go/zap/issues/new and reference this error: %v"
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
var (
|
|
40
|
-
_globalMu sync.RWMutex
|
|
41
|
-
_globalL = NewNop()
|
|
42
|
-
_globalS = _globalL.Sugar()
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
// L returns the global Logger, which can be reconfigured with ReplaceGlobals.
|
|
46
|
-
// It's safe for concurrent use.
|
|
47
|
-
func L() *Logger {
|
|
48
|
-
_globalMu.RLock()
|
|
49
|
-
l := _globalL
|
|
50
|
-
_globalMu.RUnlock()
|
|
51
|
-
return l
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// S returns the global SugaredLogger, which can be reconfigured with
|
|
55
|
-
// ReplaceGlobals. It's safe for concurrent use.
|
|
56
|
-
func S() *SugaredLogger {
|
|
57
|
-
_globalMu.RLock()
|
|
58
|
-
s := _globalS
|
|
59
|
-
_globalMu.RUnlock()
|
|
60
|
-
return s
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ReplaceGlobals replaces the global Logger and SugaredLogger, and returns a
|
|
64
|
-
// function to restore the original values. It's safe for concurrent use.
|
|
65
|
-
func ReplaceGlobals(logger *Logger) func() {
|
|
66
|
-
_globalMu.Lock()
|
|
67
|
-
prev := _globalL
|
|
68
|
-
_globalL = logger
|
|
69
|
-
_globalS = logger.Sugar()
|
|
70
|
-
_globalMu.Unlock()
|
|
71
|
-
return func() { ReplaceGlobals(prev) }
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// NewStdLog returns a *log.Logger which writes to the supplied zap Logger at
|
|
75
|
-
// InfoLevel. To redirect the standard library's package-global logging
|
|
76
|
-
// functions, use RedirectStdLog instead.
|
|
77
|
-
func NewStdLog(l *Logger) *log.Logger {
|
|
78
|
-
logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth))
|
|
79
|
-
f := logger.Info
|
|
80
|
-
return log.New(&loggerWriter{f}, "" /* prefix */, 0 /* flags */)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// NewStdLogAt returns *log.Logger which writes to supplied zap logger at
|
|
84
|
-
// required level.
|
|
85
|
-
func NewStdLogAt(l *Logger, level zapcore.Level) (*log.Logger, error) {
|
|
86
|
-
logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth))
|
|
87
|
-
logFunc, err := levelToFunc(logger, level)
|
|
88
|
-
if err != nil {
|
|
89
|
-
return nil, err
|
|
90
|
-
}
|
|
91
|
-
return log.New(&loggerWriter{logFunc}, "" /* prefix */, 0 /* flags */), nil
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// RedirectStdLog redirects output from the standard library's package-global
|
|
95
|
-
// logger to the supplied logger at InfoLevel. Since zap already handles caller
|
|
96
|
-
// annotations, timestamps, etc., it automatically disables the standard
|
|
97
|
-
// library's annotations and prefixing.
|
|
98
|
-
//
|
|
99
|
-
// It returns a function to restore the original prefix and flags and reset the
|
|
100
|
-
// standard library's output to os.Stderr.
|
|
101
|
-
func RedirectStdLog(l *Logger) func() {
|
|
102
|
-
f, err := redirectStdLogAt(l, InfoLevel)
|
|
103
|
-
if err != nil {
|
|
104
|
-
// Can't get here, since passing InfoLevel to redirectStdLogAt always
|
|
105
|
-
// works.
|
|
106
|
-
panic(fmt.Sprintf(_programmerErrorTemplate, err))
|
|
107
|
-
}
|
|
108
|
-
return f
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// RedirectStdLogAt redirects output from the standard library's package-global
|
|
112
|
-
// logger to the supplied logger at the specified level. Since zap already
|
|
113
|
-
// handles caller annotations, timestamps, etc., it automatically disables the
|
|
114
|
-
// standard library's annotations and prefixing.
|
|
115
|
-
//
|
|
116
|
-
// It returns a function to restore the original prefix and flags and reset the
|
|
117
|
-
// standard library's output to os.Stderr.
|
|
118
|
-
func RedirectStdLogAt(l *Logger, level zapcore.Level) (func(), error) {
|
|
119
|
-
return redirectStdLogAt(l, level)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
func redirectStdLogAt(l *Logger, level zapcore.Level) (func(), error) {
|
|
123
|
-
flags := log.Flags()
|
|
124
|
-
prefix := log.Prefix()
|
|
125
|
-
log.SetFlags(0)
|
|
126
|
-
log.SetPrefix("")
|
|
127
|
-
logger := l.WithOptions(AddCallerSkip(_stdLogDefaultDepth + _loggerWriterDepth))
|
|
128
|
-
logFunc, err := levelToFunc(logger, level)
|
|
129
|
-
if err != nil {
|
|
130
|
-
return nil, err
|
|
131
|
-
}
|
|
132
|
-
log.SetOutput(&loggerWriter{logFunc})
|
|
133
|
-
return func() {
|
|
134
|
-
log.SetFlags(flags)
|
|
135
|
-
log.SetPrefix(prefix)
|
|
136
|
-
log.SetOutput(os.Stderr)
|
|
137
|
-
}, nil
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
func levelToFunc(logger *Logger, lvl zapcore.Level) (func(string, ...Field), error) {
|
|
141
|
-
switch lvl {
|
|
142
|
-
case DebugLevel:
|
|
143
|
-
return logger.Debug, nil
|
|
144
|
-
case InfoLevel:
|
|
145
|
-
return logger.Info, nil
|
|
146
|
-
case WarnLevel:
|
|
147
|
-
return logger.Warn, nil
|
|
148
|
-
case ErrorLevel:
|
|
149
|
-
return logger.Error, nil
|
|
150
|
-
case DPanicLevel:
|
|
151
|
-
return logger.DPanic, nil
|
|
152
|
-
case PanicLevel:
|
|
153
|
-
return logger.Panic, nil
|
|
154
|
-
case FatalLevel:
|
|
155
|
-
return logger.Fatal, nil
|
|
156
|
-
}
|
|
157
|
-
return nil, fmt.Errorf("unrecognized level: %q", lvl)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
type loggerWriter struct {
|
|
161
|
-
logFunc func(msg string, fields ...Field)
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
func (l *loggerWriter) Write(p []byte) (int, error) {
|
|
165
|
-
p = bytes.TrimSpace(p)
|
|
166
|
-
l.logFunc(string(p))
|
|
167
|
-
return len(p), nil
|
|
168
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2019 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
|
-
// See #682 for more information.
|
|
22
|
-
// +build go1.12
|
|
23
|
-
|
|
24
|
-
package zap
|
|
25
|
-
|
|
26
|
-
const _stdLogDefaultDepth = 1
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2019 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
|
-
// See #682 for more information.
|
|
22
|
-
// +build !go1.12
|
|
23
|
-
|
|
24
|
-
package zap
|
|
25
|
-
|
|
26
|
-
const _stdLogDefaultDepth = 2
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
module go.uber.org/zap
|
|
2
|
-
|
|
3
|
-
go 1.13
|
|
4
|
-
|
|
5
|
-
require (
|
|
6
|
-
github.com/pkg/errors v0.8.1
|
|
7
|
-
github.com/stretchr/testify v1.4.0
|
|
8
|
-
go.uber.org/atomic v1.6.0
|
|
9
|
-
go.uber.org/multierr v1.5.0
|
|
10
|
-
golang.org/x/lint v0.0.0-20190930215403-16217165b5de
|
|
11
|
-
gopkg.in/yaml.v2 v2.2.2
|
|
12
|
-
honnef.co/go/tools v0.0.1-2019.2.3
|
|
13
|
-
)
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
|
2
|
-
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
3
|
-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
|
4
|
-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
5
|
-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
6
|
-
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
7
|
-
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
|
8
|
-
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
|
9
|
-
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
|
10
|
-
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
11
|
-
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|
12
|
-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
13
|
-
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
14
|
-
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
|
15
|
-
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
16
|
-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
17
|
-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
18
|
-
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
|
19
|
-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
20
|
-
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
21
|
-
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
|
22
|
-
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
|
23
|
-
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
|
|
24
|
-
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
|
25
|
-
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
|
|
26
|
-
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
|
27
|
-
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
|
|
28
|
-
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
|
29
|
-
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
|
30
|
-
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
31
|
-
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
|
|
32
|
-
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
33
|
-
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
|
34
|
-
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
35
|
-
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
36
|
-
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
37
|
-
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
38
|
-
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
39
|
-
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
40
|
-
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
41
|
-
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
42
|
-
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
43
|
-
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c h1:IGkKhmfzcztjm6gYkykvu/NiS8kaqbCWAEWWAyf8J5U=
|
|
44
|
-
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
45
|
-
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64bikrLBkAgPir1TNCj3Zs=
|
|
46
|
-
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
47
|
-
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
48
|
-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
49
|
-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
50
|
-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
|
51
|
-
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
52
|
-
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|
53
|
-
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
|
54
|
-
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
55
|
-
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
|
|
56
|
-
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
|
@@ -1,81 +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 zap
|
|
22
|
-
|
|
23
|
-
import (
|
|
24
|
-
"encoding/json"
|
|
25
|
-
"fmt"
|
|
26
|
-
"net/http"
|
|
27
|
-
|
|
28
|
-
"go.uber.org/zap/zapcore"
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
// ServeHTTP is a simple JSON endpoint that can report on or change the current
|
|
32
|
-
// logging level.
|
|
33
|
-
//
|
|
34
|
-
// GET requests return a JSON description of the current logging level. PUT
|
|
35
|
-
// requests change the logging level and expect a payload like:
|
|
36
|
-
// {"level":"info"}
|
|
37
|
-
//
|
|
38
|
-
// It's perfectly safe to change the logging level while a program is running.
|
|
39
|
-
func (lvl AtomicLevel) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
40
|
-
type errorResponse struct {
|
|
41
|
-
Error string `json:"error"`
|
|
42
|
-
}
|
|
43
|
-
type payload struct {
|
|
44
|
-
Level *zapcore.Level `json:"level"`
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
enc := json.NewEncoder(w)
|
|
48
|
-
|
|
49
|
-
switch r.Method {
|
|
50
|
-
|
|
51
|
-
case http.MethodGet:
|
|
52
|
-
current := lvl.Level()
|
|
53
|
-
enc.Encode(payload{Level: ¤t})
|
|
54
|
-
|
|
55
|
-
case http.MethodPut:
|
|
56
|
-
var req payload
|
|
57
|
-
|
|
58
|
-
if errmess := func() string {
|
|
59
|
-
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
|
|
60
|
-
return fmt.Sprintf("Request body must be well-formed JSON: %v", err)
|
|
61
|
-
}
|
|
62
|
-
if req.Level == nil {
|
|
63
|
-
return "Must specify a logging level."
|
|
64
|
-
}
|
|
65
|
-
return ""
|
|
66
|
-
}(); errmess != "" {
|
|
67
|
-
w.WriteHeader(http.StatusBadRequest)
|
|
68
|
-
enc.Encode(errorResponse{Error: errmess})
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
lvl.SetLevel(*req.Level)
|
|
73
|
-
enc.Encode(req)
|
|
74
|
-
|
|
75
|
-
default:
|
|
76
|
-
w.WriteHeader(http.StatusMethodNotAllowed)
|
|
77
|
-
enc.Encode(errorResponse{
|
|
78
|
-
Error: "Only GET and PUT are supported.",
|
|
79
|
-
})
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,31 +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 bufferpool houses zap's shared internal buffer pool. Third-party
|
|
22
|
-
// packages can recreate the same functionality with buffers.NewPool.
|
|
23
|
-
package bufferpool
|
|
24
|
-
|
|
25
|
-
import "go.uber.org/zap/buffer"
|
|
26
|
-
|
|
27
|
-
var (
|
|
28
|
-
_pool = buffer.NewPool()
|
|
29
|
-
// Get retrieves a buffer from the pool, creating one if necessary.
|
|
30
|
-
Get = _pool.Get
|
|
31
|
-
)
|
|
@@ -1,44 +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 color adds coloring functionality for TTY output.
|
|
22
|
-
package color
|
|
23
|
-
|
|
24
|
-
import "fmt"
|
|
25
|
-
|
|
26
|
-
// Foreground colors.
|
|
27
|
-
const (
|
|
28
|
-
Black Color = iota + 30
|
|
29
|
-
Red
|
|
30
|
-
Green
|
|
31
|
-
Yellow
|
|
32
|
-
Blue
|
|
33
|
-
Magenta
|
|
34
|
-
Cyan
|
|
35
|
-
White
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
// Color represents a text color.
|
|
39
|
-
type Color uint8
|
|
40
|
-
|
|
41
|
-
// Add adds the coloring to the given string.
|
|
42
|
-
func (c Color) Add(s string) string {
|
|
43
|
-
return fmt.Sprintf("\x1b[%dm%s\x1b[0m", uint8(c), s)
|
|
44
|
-
}
|
|
@@ -1,64 +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 exit provides stubs so that unit tests can exercise code that calls
|
|
22
|
-
// os.Exit(1).
|
|
23
|
-
package exit
|
|
24
|
-
|
|
25
|
-
import "os"
|
|
26
|
-
|
|
27
|
-
var real = func() { os.Exit(1) }
|
|
28
|
-
|
|
29
|
-
// Exit normally terminates the process by calling os.Exit(1). If the package
|
|
30
|
-
// is stubbed, it instead records a call in the testing spy.
|
|
31
|
-
func Exit() {
|
|
32
|
-
real()
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// A StubbedExit is a testing fake for os.Exit.
|
|
36
|
-
type StubbedExit struct {
|
|
37
|
-
Exited bool
|
|
38
|
-
prev func()
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Stub substitutes a fake for the call to os.Exit(1).
|
|
42
|
-
func Stub() *StubbedExit {
|
|
43
|
-
s := &StubbedExit{prev: real}
|
|
44
|
-
real = s.exit
|
|
45
|
-
return s
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// WithStub runs the supplied function with Exit stubbed. It returns the stub
|
|
49
|
-
// used, so that users can test whether the process would have crashed.
|
|
50
|
-
func WithStub(f func()) *StubbedExit {
|
|
51
|
-
s := Stub()
|
|
52
|
-
defer s.Unstub()
|
|
53
|
-
f()
|
|
54
|
-
return s
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Unstub restores the previous exit function.
|
|
58
|
-
func (se *StubbedExit) Unstub() {
|
|
59
|
-
real = se.prev
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
func (se *StubbedExit) exit() {
|
|
63
|
-
se.Exited = true
|
|
64
|
-
}
|
|
@@ -1,132 +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 zap
|
|
22
|
-
|
|
23
|
-
import (
|
|
24
|
-
"go.uber.org/atomic"
|
|
25
|
-
"go.uber.org/zap/zapcore"
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
const (
|
|
29
|
-
// DebugLevel logs are typically voluminous, and are usually disabled in
|
|
30
|
-
// production.
|
|
31
|
-
DebugLevel = zapcore.DebugLevel
|
|
32
|
-
// InfoLevel is the default logging priority.
|
|
33
|
-
InfoLevel = zapcore.InfoLevel
|
|
34
|
-
// WarnLevel logs are more important than Info, but don't need individual
|
|
35
|
-
// human review.
|
|
36
|
-
WarnLevel = zapcore.WarnLevel
|
|
37
|
-
// ErrorLevel logs are high-priority. If an application is running smoothly,
|
|
38
|
-
// it shouldn't generate any error-level logs.
|
|
39
|
-
ErrorLevel = zapcore.ErrorLevel
|
|
40
|
-
// DPanicLevel logs are particularly important errors. In development the
|
|
41
|
-
// logger panics after writing the message.
|
|
42
|
-
DPanicLevel = zapcore.DPanicLevel
|
|
43
|
-
// PanicLevel logs a message, then panics.
|
|
44
|
-
PanicLevel = zapcore.PanicLevel
|
|
45
|
-
// FatalLevel logs a message, then calls os.Exit(1).
|
|
46
|
-
FatalLevel = zapcore.FatalLevel
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
// LevelEnablerFunc is a convenient way to implement zapcore.LevelEnabler with
|
|
50
|
-
// an anonymous function.
|
|
51
|
-
//
|
|
52
|
-
// It's particularly useful when splitting log output between different
|
|
53
|
-
// outputs (e.g., standard error and standard out). For sample code, see the
|
|
54
|
-
// package-level AdvancedConfiguration example.
|
|
55
|
-
type LevelEnablerFunc func(zapcore.Level) bool
|
|
56
|
-
|
|
57
|
-
// Enabled calls the wrapped function.
|
|
58
|
-
func (f LevelEnablerFunc) Enabled(lvl zapcore.Level) bool { return f(lvl) }
|
|
59
|
-
|
|
60
|
-
// An AtomicLevel is an atomically changeable, dynamic logging level. It lets
|
|
61
|
-
// you safely change the log level of a tree of loggers (the root logger and
|
|
62
|
-
// any children created by adding context) at runtime.
|
|
63
|
-
//
|
|
64
|
-
// The AtomicLevel itself is an http.Handler that serves a JSON endpoint to
|
|
65
|
-
// alter its level.
|
|
66
|
-
//
|
|
67
|
-
// AtomicLevels must be created with the NewAtomicLevel constructor to allocate
|
|
68
|
-
// their internal atomic pointer.
|
|
69
|
-
type AtomicLevel struct {
|
|
70
|
-
l *atomic.Int32
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// NewAtomicLevel creates an AtomicLevel with InfoLevel and above logging
|
|
74
|
-
// enabled.
|
|
75
|
-
func NewAtomicLevel() AtomicLevel {
|
|
76
|
-
return AtomicLevel{
|
|
77
|
-
l: atomic.NewInt32(int32(InfoLevel)),
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// NewAtomicLevelAt is a convenience function that creates an AtomicLevel
|
|
82
|
-
// and then calls SetLevel with the given level.
|
|
83
|
-
func NewAtomicLevelAt(l zapcore.Level) AtomicLevel {
|
|
84
|
-
a := NewAtomicLevel()
|
|
85
|
-
a.SetLevel(l)
|
|
86
|
-
return a
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// Enabled implements the zapcore.LevelEnabler interface, which allows the
|
|
90
|
-
// AtomicLevel to be used in place of traditional static levels.
|
|
91
|
-
func (lvl AtomicLevel) Enabled(l zapcore.Level) bool {
|
|
92
|
-
return lvl.Level().Enabled(l)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Level returns the minimum enabled log level.
|
|
96
|
-
func (lvl AtomicLevel) Level() zapcore.Level {
|
|
97
|
-
return zapcore.Level(int8(lvl.l.Load()))
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// SetLevel alters the logging level.
|
|
101
|
-
func (lvl AtomicLevel) SetLevel(l zapcore.Level) {
|
|
102
|
-
lvl.l.Store(int32(l))
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// String returns the string representation of the underlying Level.
|
|
106
|
-
func (lvl AtomicLevel) String() string {
|
|
107
|
-
return lvl.Level().String()
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// UnmarshalText unmarshals the text to an AtomicLevel. It uses the same text
|
|
111
|
-
// representations as the static zapcore.Levels ("debug", "info", "warn",
|
|
112
|
-
// "error", "dpanic", "panic", and "fatal").
|
|
113
|
-
func (lvl *AtomicLevel) UnmarshalText(text []byte) error {
|
|
114
|
-
if lvl.l == nil {
|
|
115
|
-
lvl.l = &atomic.Int32{}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
var l zapcore.Level
|
|
119
|
-
if err := l.UnmarshalText(text); err != nil {
|
|
120
|
-
return err
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
lvl.SetLevel(l)
|
|
124
|
-
return nil
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// MarshalText marshals the AtomicLevel to a byte slice. It uses the same
|
|
128
|
-
// text representation as the static zapcore.Levels ("debug", "info", "warn",
|
|
129
|
-
// "error", "dpanic", "panic", and "fatal").
|
|
130
|
-
func (lvl AtomicLevel) MarshalText() (text []byte, err error) {
|
|
131
|
-
return lvl.Level().MarshalText()
|
|
132
|
-
}
|