Commit Graph

160 Commits

Author SHA1 Message Date
Olivier Poitrey a572c9d1f6 Add missing support for zerolog marshable objects to Fields 2018-05-09 03:52:30 -07:00
Olivier Poitrey 79281e4bf6 Fix Event.Times when format is set to UNIX time 2018-05-09 03:52:30 -07:00
Ravi Raju 57da509ee1 Add JournalD Writer (#57)
JournalD writer decodes each log event and map fields to journald fields. The JSON payload is kept in the `JSON` field.
2018-04-26 23:15:29 -07:00
Olivier Poitrey 89162918d0
Add grpc-zerolog reference (fix #58) 2018-04-26 13:41:11 -07:00
Olivier Poitrey d2b7a51951 Do not print large ints using scientific notation with ConsoleWriter
Fixes #55
2018-04-19 13:13:40 -07:00
Dan Gillis 711d95f5f1 Some new readability updates (#54) 2018-04-18 20:29:59 -07:00
Ilya Galimyanov 1e2ce57d98 Make GlobalLevel a public function (#53) 2018-04-17 15:52:22 -07:00
Ravi Raju 70bea47cc0 Fix for a bug in cbor decodeFloat (#51) 2018-04-13 00:13:41 -07:00
Ravi Raju 2ccfab3e07 Support for adding IP Address/Prefix + stream based decoder (#49)
* added IPAddr, IPPrefix and stream based cbor decoder
* Update README with cbor decoder tool info
* Update README in cbor with comparison data
2018-04-03 23:07:18 +02:00
Olivier Poitrey 05eafee0eb Update README with instruction about binary encoding 2018-03-28 11:59:26 -07:00
Ravi Raju ddfae1b613 Binary format support (#37)
Adds support for binary logging (with cbor encoding) in addition to JSON. Use the binary_log compile tag to enable the feature.
2018-03-28 11:49:41 -07:00
Olivier Poitrey 3ab376bc30
Add "Who uses zerolog" wiki page link 2018-03-25 22:34:03 -07:00
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 3786fbfa73 Add support for stack trace extration of error fields 2018-02-11 17:55:34 -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