New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release v1.17.0 #956
Release v1.17.0 #956
Commits on Nov 12, 2020
Commits on Nov 24, 2020
-
-
field/error: Handle panic in Error() (#867)
We shouldn't panic if the `Error()` method of an `error` panics. ``` type T struct{ msg string } func (t *T) Error() string { return t.msg } // The following panics. var n *T = nil log.Info("panic", zap.Error(n)) ``` Co-authored-by: Abhinav Gupta <mail@abhinavg.net>
-
Commits on Dec 11, 2020
-
Byte alignment, optimization from 96 to 80 byte (#865)
村口大白鹅 committedDec 11, 2020 -
Commits on May 25, 2021
-
http: support additional content type (#903)
Support `application/x-www-form-urlencoded` as an additional content type for `AtomicLevel.ServeHTTP`. This is the default content type for `curl -X POST`. With this change, interacting with the HTTP endpoint is a bit more user friendly: ``` curl -X PUT localhost:8080/log/level -d level=debug ``` Additionally, the unit tests for the HTTP handler are transformed to a table driven approach. fixes #902 Co-authored-by: Abhinav Gupta <abg@uber.com>
-
-
Optimize Sugar logger for calls with a single string arg (#913)
Currently, the Sugar logger uses fmt.Sprint in all cases when the template is empty. However, this call is unnecessary if there's a single string type argument, as we can use it directly. With this optimization, we reduce the cost and avoid an unnecessary alloc: ``` > benchcmp pre post benchmark old ns/op new ns/op delta BenchmarkSugarSingleStrArg-10 636 570 -10.38% benchmark old allocs new allocs delta BenchmarkSugarSingleStrArg-10 1 0 -100.00% ```
-
tools: Move to submodule (#914)
This moves development tool dependencies to a subdirectory so that these are not added as dependencies of zap.
-
Add support for grpclog.LoggerV2 (#881)
gRPC has an updated [logger interface][1] that the v1 API has been deprecated in favor of. [1]: https://pkg.go.dev/google.golang.org/grpc/grpclog#LoggerV2 This adds support for it to the existing gRPC adapter in Zap. Fixes #534 Closes #538 Co-authored-by: Prashant Varanasi <github@prashantv.com> Co-authored-by: Abhinav Gupta <abg@uber.com>
-
Support multi-field encoding using zap.Inline (#912)
Fixes #876 Currently, a `zap.Field` can only represent a single key-value. Add `zap.Inline` to allow adding multiple fields to the current namespace from a type implementing `zap.ObjectMarshaler`. This also solves a more general problem: a single `zap.Field` can now be used to add multiple key/value pairs.
-
Add FilterFieldKey to zaptest/observer (#928)
Adds functionality to filter zap.Field by key. This makes testing for field existence regardless of value more convenient. resolves #816
-
Update dependencies to fix vulnerabilities (#931)
- go.uber.org/atomic@1.6.0 - go.uber.org/multierr@1.5.0. Removes a lot of no longer needed dependencies and fixes vulnerabilities including the following: - golang.org/x/crypto (CVE-2020-9283) - golang.org/x/text (CVE-2020-14040)
-
zapcore: Cleanup copy in NewMultiWriteSyncer (#934)
The copy was originally in place due to golang/go#7809 Since that issue was fixed in Go 1.3 a few years ago, it seems safe to drop the copy.
-
Switch from Travis to GitHub Actions (#940)
We're deprecating use of Travis for our OSS projects, so switch to GitHub Actions for it. Unfortunately, this required dropping tests we had against ppc64le because [GitHub Workflows doesn't support it][1]. [1]: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#github-hosted-runners
-
Update dependencies to fix vulnerabilities in (#936)
- gopkg.in/yaml.v2 v2.2.2 -> v.2.2.8 CVE-2019-11254
-
This utility allows creating a logger with "advanced" filters like in the following example. It is particularly convenient to use with a CLI flag package or using environment variables. core := zap.NewExample().Core() // *=myns => any level, myns namespace // info,warn:myns.* => info or warn level, any namespace matching myns.* // error=* => everything with error level logger := zap.New(zapfilter.NewFilteringCore(core, zapfilter.MustParseRules("*:myns info,warn:myns.* error:*"))) defer logger.Sync() logger.Debug("top debug") // no match logger.Named("myns").Debug("myns debug") // matches *:myns logger.Named("bar").Debug("bar debug") // no match logger.Named("myns").Named("foo").Debug("myns.foo debug") // no match logger.Info("top info") // no match logger.Named("myns").Info("myns info") // matches *:myns logger.Named("bar").Info("bar info") // no match logger.Named("myns").Named("foo").Info("myns.foo info") // matches info,warn:myns.* logger.Warn("top warn") // no match logger.Named("myns").Warn("myns warn") // matches *:myns logger.Named("bar").Warn("bar warn") // no match logger.Named("myns").Named("foo").Warn("myns.foo warn") // matches info,warn:myns.* logger.Error("top error") // matches error:* logger.Named("myns").Error("myns error") // matches *:myns and error:* logger.Named("bar").Error("bar error") // matches error:* logger.Named("myns").Named("foo").Error("myns.foo error") // matches error:* // Output: // {"level":"debug","logger":"myns","msg":"myns debug"} // {"level":"info","logger":"myns","msg":"myns info"} // {"level":"info","logger":"myns.foo","msg":"myns.foo info"} // {"level":"warn","logger":"myns","msg":"myns warn"} // {"level":"warn","logger":"myns.foo","msg":"myns.foo warn"} // {"level":"error","msg":"top error"} // {"level":"error","logger":"myns","msg":"myns error"} // {"level":"error","logger":"bar","msg":"bar error"} // {"level":"error","logger":"myns.foo","msg":"myns.foo error"}
-
internal/readme: Simplify if condition (#945)
Check for "both true" or "both false" is easily implemented as `x == y`.
-
A recent change to dependencies neglected to run `go mod tidy`.
-
lint: Check that 'go mod tidy' was run (#951)
In #948, we noticed that some `go.sum` files were outdated. To avoid this in the future, add a `lint` check that verifies that `go mod tidy` does not cause any changes. This will fail with a dirty working tree as well, but in CI, we don't expect that.
-
Add a FOSSA check to the build steps. Resolves: GO-468
-
zapcore/FieldType: Don't change enum values (#955)
Although the values of the FieldType enums aren't part of the Zap contract, changing existing values is still a risky change. [apidiff] considers this a brekaing change. ``` Incompatible changes: - BinaryType: value changed from 3 to 4 - BoolType: value changed from 4 to 5 - ByteStringType: value changed from 5 to 6 - Complex128Type: value changed from 6 to 7 - Complex64Type: value changed from 7 to 8 - DurationType: value changed from 8 to 9 - ErrorType: value changed from 26 to 27 - Float32Type: value changed from 10 to 11 - Float64Type: value changed from 9 to 10 - Int16Type: value changed from 13 to 14 - Int32Type: value changed from 12 to 13 - Int64Type: value changed from 11 to 12 - Int8Type: value changed from 14 to 15 - NamespaceType: value changed from 24 to 25 - ReflectType: value changed from 23 to 24 - SkipType: value changed from 27 to 28 - StringType: value changed from 15 to 16 - StringerType: value changed from 25 to 26 - TimeFullType: value changed from 17 to 18 - TimeType: value changed from 16 to 17 - Uint16Type: value changed from 20 to 21 - Uint32Type: value changed from 19 to 20 - Uint64Type: value changed from 18 to 19 - Uint8Type: value changed from 21 to 22 - UintptrType: value changed from 22 to 23 ``` [apidiff]: https://github.com/golang/exp/blob/master/apidiff/README.md Again, although maintianing these values is not part of the Zap contract, in the interest of erring on the side of safety, I'm moving the new FieldType (added in #912) to the bottom to avoid changing the values of the other items.