Commit Graph

197 Commits

Author SHA1 Message Date
Olivier Poitrey d0ca9bbceb Add support for pointer values in Fields
Fixes #46
2018-03-25 20:18:47 -07:00
Olivier Poitrey 24cc441b11 Add more json type tests 2018-03-23 09:58:31 -07:00
Olivier Poitrey 4ea03de40d Optimize JSON string encoding using a lookup table
benchstat old new
name                             old time/op    new time/op    delta
AppendString/MultiBytesFirst-8     77.9ns ± 5%    70.2ns ± 1%   -9.88%  (p=0.008 n=5+5)
AppendString/MultiBytesMiddle-8    64.2ns ± 1%    56.3ns ± 5%  -12.19%  (p=0.008 n=5+5)
AppendString/MultiBytesLast-8      51.2ns ± 2%    45.2ns ± 4%  -11.65%  (p=0.008 n=5+5)
AppendString/NoEncoding-8          36.2ns ± 4%    34.0ns ± 6%     ~     (p=0.087 n=5+5)
AppendString/EncodingFirst-8       67.7ns ± 2%    59.4ns ± 2%  -12.26%  (p=0.008 n=5+5)
AppendString/EncodingMiddle-8      56.5ns ± 2%    50.6ns ± 5%  -10.54%  (p=0.008 n=5+5)
AppendString/EncodingLast-8        41.3ns ± 1%    39.6ns ± 5%   -4.11%  (p=0.024 n=5+5)
AppendBytes/MultiBytesLast-8       53.5ns ± 6%    45.6ns ± 4%  -14.79%  (p=0.008 n=5+5)
AppendBytes/NoEncoding-8           36.3ns ± 3%    28.6ns ± 3%  -21.10%  (p=0.008 n=5+5)
AppendBytes/EncodingFirst-8        67.3ns ± 4%    62.1ns ± 4%   -7.75%  (p=0.008 n=5+5)
AppendBytes/EncodingMiddle-8       59.2ns ± 7%    51.0ns ± 6%  -13.85%  (p=0.008 n=5+5)
AppendBytes/EncodingLast-8         43.7ns ± 6%    34.4ns ± 2%  -21.32%  (p=0.008 n=5+5)
AppendBytes/MultiBytesFirst-8      77.7ns ± 2%    71.2ns ± 3%   -8.37%  (p=0.008 n=5+5)
AppendBytes/MultiBytesMiddle-8     63.6ns ± 3%    57.8ns ± 5%   -9.12%  (p=0.008 n=5+5)
2018-03-23 04:24:50 -07:00
Johan Sim Jian An 5250a1ba2d Check nil in RawJSON. (#45) 2018-03-22 21:08:22 -07:00
Ryan Boehning be4b7c1474 Update for Go 1.10 (#39)
* Add Go 1.10 to .travis.yml.
* Add quotes to Go versions in .travis.yml, because unquoted 1.10 is interpreted
as Go 1.1.
* Change .travis.yml references from 'tip' to 'master'. 'tip' is a legacy reference
coming from the days when the Go project used mercurial instead of git.
2018-03-15 10:50:30 -07:00
Max Wolter 1c575db928 Add support for hex-encoded of byte slice (#42) 2018-03-15 10:29:26 -07:00
Kai Ren b62d797a8d Mention fields duplication caveat in documentation (#41) 2018-03-08 07:41:28 -08:00
Olivier Poitrey 8c1c6a0cd7 Add diode.Writer, a thread-safe, lock-free, non-blocking writer wrapper 2018-02-20 02:33:26 -08:00
Giovanni Bajo 9ee98f91c4 Remove allocations while logging an Array of Objects. (#38) 2018-02-13 11:18:01 -08:00
Olivier Poitrey a717e7cbed Improve ConsoleWriter of non-scalar types 2018-02-13 00:20:42 -08:00
Olivier Poitrey 56a970de51 Add RawJSON field type 2018-02-12 16:05:27 -08:00
Olivier Poitrey 9a92fd2536 Fix typoes 2018-02-10 18:57:53 -08:00
Olivier Poitrey 7d8f9e5cf0 Fix unit tests 2018-02-08 21:29:16 -08:00
Dan Gillis 8eb285b62b Updates to README.md to help with readability (#32)
* Added missed >m< in github.com
* Added backquotes to denote "code" where appropriate
* Cleanup based on feedback
* Added three examples from README
* Removed Output for 3 examples
* Updated Setting Global Log Level section w/ flags
* Removed unnecessary blank lines
* Moved flags from init into main
* Update log_example_test.go
* Cosmetic change based on Olivier's feedback
* Pushed back to original
* New Examples for Log package
* Removed extra spaces
* Reorganized file and added examples
2018-02-08 21:00:09 -08:00
Olivier Poitrey 27e0a22cbc Add the ability to capture the logger caller file and line number
Fixes #34, #22
2018-02-07 13:54:26 -08:00
Olivier Poitrey fcbdf23e9e Use new hook internally to handle timestamp in context 2018-02-07 13:31:00 -08:00
Olivier Poitrey cbec2377ee Add benchmarks for context 2018-02-07 13:07:46 -08:00
Olivier Poitrey b53826c57a
Add go 1.9 to travis file 2018-01-04 11:28:02 -08:00
zy 1cc67e6325 fix: performance link to invalid section in README.md (#30)
- No performance section in README.md, change link to performance to benchmarks
2018-01-04 11:19:48 -08:00
nogoegst c2fc1c63dc Add missing WithLevel method to log package (#27) 2017-12-14 10:33:32 -08:00
Rodrigo Coelho c3d02683c7 Add hook support (#24) 2017-12-01 10:52:37 -07:00
millerlogic 1251b38a89 Fix sampler for low Burst values (#19) 2017-11-27 10:05:35 -08:00
Rodrigo Coelho c8e50a6043 Fix tests for Windows. (#23) 2017-11-27 10:01:32 -08:00
Ravi Raju 9a65e7ccd2 Fix Output with existing context (fix #20)
Also includes tests for Output()
2017-11-08 10:47:56 -08:00
Giovanni Bajo 89e128fdc1 Speed up operations when logging is disabled. (#18)
Low-level optimizations to help the compiler generate better code
when logging is disabled. Measured improvement is ~30% on amd64
(from 21 ns/op to 16 ns/op).
2017-11-05 05:22:20 -08:00
Olivier Poitrey 9d194eb6f5 Remove redundant condition 2017-09-11 14:52:32 -07:00
Olivier Poitrey 3ac71fc58d Simplify copies 2017-09-03 11:01:28 -07:00
Olivier Poitrey 26094019c8 Fix godoc 2017-09-01 20:07:47 -07:00
Olivier Poitrey 8c682b3b12 Add Print and Printf top level methods 2017-09-01 19:59:48 -07:00
Olivier Poitrey 96c2125038 Update readme to reference Mário Freitas' benchmarks 2017-09-01 19:45:46 -07:00
Olivier Poitrey d76a89fffc Add benchmark for context appending 2017-08-29 23:10:40 -07:00
Olivier Poitrey e26050b2a3 Improve hlog handlers performance by switching to pointer logger
Update request logger's context thru its pointer in order to avoid
multiple copies/allocations.
2017-08-29 22:53:32 -07:00
Olivier Poitrey 560e8848f1 Remove the SampleFieldName global 2017-08-29 10:35:43 -07:00
Olivier Poitrey 9e5c06cf0e Add more advanced sampling modes 2017-08-28 23:30:54 -07:00
Olivier Poitrey 46339da83a Improve doc for WithContext 2017-08-12 16:16:31 -07:00
Olivier Poitrey 2ed2f2c974 Fix pretty logging and add a screenshot to the README 2017-08-05 20:45:41 -07:00
Olivier Poitrey 90fdb63d84 Add missing console file 2017-08-05 19:59:04 -07:00
Olivier Poitrey a83efb6080 Add a ConsoleWriter to output pretty log on the console during dev 2017-08-05 19:47:55 -07:00
Olivier Poitrey 89ff8dbc5f Small comment fix 2017-07-26 23:42:12 -07:00
Olivier Poitrey 614d88bbf8 Add support for typed array. 2017-07-26 00:30:03 -07:00
Olivier Poitrey 6cdd9977c4 Refactor JSON encoding code 2017-07-25 22:05:32 -07:00
Olivier Poitrey fdbdb09630 Add support for custom object marshaling 2017-07-25 18:41:05 -07:00
Olivier Poitrey f220d89e1f Add more benchmarks 2017-07-25 17:25:40 -07:00
Olivier Poitrey 87aceba511 Handle special values like Inf and NaN gracefuly 2017-07-25 16:55:47 -07:00
Olivier Poitrey 2aa3c3ae4f Add some array types support 2017-07-25 12:50:35 -07:00
Olivier Poitrey eed4c2b94d Add access log handler 2017-07-10 03:45:23 -07:00
Olivier Poitrey 7af653895b Add utility functions WithLevel and Fields
Add some utility functions to ease migration from other logger API.
2017-07-10 02:58:58 -07:00
Olivier Poitrey c964fc4812 Merge pull request #8 from unixisevil/zerolog/fix
fix typo error
2017-07-06 22:29:54 -07:00
Olivier Poitrey 72d41dedeb Add []byte fields support
Add efficient []byte field support with no string conversion.
2017-07-01 12:48:32 -07:00
yj 1b37e7fcd9 fix typo error 2017-06-30 22:53:27 +08:00