Skip to content

Commit

Permalink
Support fast Zap logging (#366)
Browse files Browse the repository at this point in the history
This adds a `zapcore.MarshalLogObject/Array` method to all generated structs
and its underlying components, enums, and non-primitive typedefs, implementing
Zap marshalers (i.e. [ObjectMarshaler], [ArrayMarshaler]).

For typedefs of primitives, the logging is up to the user, simply by casting
it down to the root type and using the respective `Add/Append...` method of
the Zap encoder.

  [ObjectMarshaler]: https://godoc.org/go.uber.org/zap/zapcore#ObjectMarshaler
  [ArrayMarshaler]: https://godoc.org/go.uber.org/zap/zapcore#ArrayMarshaler
  • Loading branch information
mh-park authored and abhinav committed Aug 14, 2018
1 parent 53375f1 commit 6cfc64a
Show file tree
Hide file tree
Showing 58 changed files with 4,454 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ go_import_path: go.uber.org/thriftrw

matrix:
include:
- go: 1.7
- go: 1.8
- go: 1.9
- go: '1.10'
env: LINT=1
Expand Down
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
- No changes yet.
### Added
- Generated types now implement zapcore.ObjectMarshaler or
zapcore.ArrayMarshaler where appropriate. This should lead to much faster
logging of these objects.

## [1.12.0] - 2018-06-25
### Added
Expand Down
148 changes: 148 additions & 0 deletions envelope/internal/tests/enums/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions envelope/internal/tests/exceptions/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions envelope/internal/tests/services/cache_clear.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions envelope/internal/tests/services/cache_clearafter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions envelope/internal/tests/services/conflictingnames_setvalue.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6cfc64a

Please sign in to comment.