Skip to content
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

Merged
merged 25 commits into from May 25, 2021
Merged

Release v1.17.0 #956

merged 25 commits into from May 25, 2021

Commits on Nov 12, 2020

  1. Add FAQ question on zap dropping logs due to sampling (#875)

    Multiple issues have been opened about missing logs (e.g., #874, #588).
    
    While sampling is mentioned in the API documentation for `NewProductionConfig`,
    it may help to add an FAQ question as well.
    prashantv committed Nov 12, 2020
    Copy the full SHA
    9d2e5de View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2020

  1. Copy the full SHA
    495658f View commit details
    Browse the repository at this point in the history
  2. 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>
    FMLS and abhinav committed Nov 24, 2020
    Copy the full SHA
    4b2b07c View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    5b4722d View commit details
    Browse the repository at this point in the history

Commits on Dec 11, 2020

  1. Byte alignment, optimization from 96 to 80 byte (#865)

    村口大白鹅 committed Dec 11, 2020
    Copy the full SHA
    f5a3592 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    a68efdb View commit details
    Browse the repository at this point in the history

Commits on May 25, 2021

  1. 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>
    oncilla and abhinav committed May 25, 2021
    Copy the full SHA
    864bed1 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    9f3c0ee View commit details
    Browse the repository at this point in the history
  3. 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%
    ```
    prashantv authored and abhinav committed May 25, 2021
    Copy the full SHA
    dca7c25 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    d5dd706 View commit details
    Browse the repository at this point in the history
  5. tools: Move to submodule (#914)

    This moves development tool dependencies to a subdirectory so that
    these are not added as dependencies of zap.
    markusthoemmes authored and abhinav committed May 25, 2021
    Copy the full SHA
    b73d9b5 View commit details
    Browse the repository at this point in the history
  6. 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>
    3 people committed May 25, 2021
    Copy the full SHA
    6f4d093 View commit details
    Browse the repository at this point in the history
  7. 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.
    prashantv authored and abhinav committed May 25, 2021
    Copy the full SHA
    016a93b View commit details
    Browse the repository at this point in the history
  8. 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
    r-hang authored and abhinav committed May 25, 2021
    Copy the full SHA
    8d5e39e View commit details
    Browse the repository at this point in the history
  9. 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)
    tsoslow authored and abhinav committed May 25, 2021
    Copy the full SHA
    92549f9 View commit details
    Browse the repository at this point in the history
  10. 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.
    prashantv authored and abhinav committed May 25, 2021
    Copy the full SHA
    15dca18 View commit details
    Browse the repository at this point in the history
  11. 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
    shirchen authored and abhinav committed May 25, 2021
    Copy the full SHA
    9a9e13f View commit details
    Browse the repository at this point in the history
  12. Update dependencies to fix vulnerabilities in (#936)

    - gopkg.in/yaml.v2 v2.2.2 -> v.2.2.8 CVE-2019-11254
    jimmystewpot authored and abhinav committed May 25, 2021
    Copy the full SHA
    34ea13c View commit details
    Browse the repository at this point in the history
  13. FAQ: Add zapfilter (#939)

    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"}
    moul authored and abhinav committed May 25, 2021
    Copy the full SHA
    2f8e331 View commit details
    Browse the repository at this point in the history
  14. internal/readme: Simplify if condition (#945)

    Check for "both true" or "both false" is easily implemented as `x == y`.
    tylitianrui authored and abhinav committed May 25, 2021
    Copy the full SHA
    2732714 View commit details
    Browse the repository at this point in the history
  15. go mod tidy (#947)

    A recent change to dependencies neglected to run `go mod tidy`.
    abhinav committed May 25, 2021
    Copy the full SHA
    756fb2a View commit details
    Browse the repository at this point in the history
  16. 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.
    abhinav committed May 25, 2021
    Copy the full SHA
    4110cb4 View commit details
    Browse the repository at this point in the history
  17. Integrate FOSSA (#953)

    Add a FOSSA check to the build steps.
    
    Resolves: GO-468
    manjari25 authored and abhinav committed May 25, 2021
    Copy the full SHA
    d3092aa View commit details
    Browse the repository at this point in the history
  18. 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.
    abhinav committed May 25, 2021
    Copy the full SHA
    f612082 View commit details
    Browse the repository at this point in the history
  19. Prepare release v1.17.0

    This prepares the v1.17.0 release of Zap.
    abhinav committed May 25, 2021
    Copy the full SHA
    75ac0de View commit details
    Browse the repository at this point in the history