Commit Graph

125 Commits

Author SHA1 Message Date
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
Olivier Poitrey 447d0fc7f5 Optimize JSON encoding even further
Last optimization was for JSON string with no character to encode. This
version focuses on strings with some chars to encode, trying to apply
the same trick for substrings that do not need encoding.

benchmark                old ns/op     new ns/op    delta
.../NoEncoding-8         60.2          51.3         -14.78%
.../EncodingFirst-8      140           116          -17.14%
.../EncodingMiddle-8     112           86.4         -22.86%
.../EncodingLast-8       62.8          61.1         -2.71%
.../MultiBytesFirst-8    164           129          -21.34%
.../MultiBytesMiddle-8   133           96.9         -27.14%
.../MultiBytesLast-8     81.9          73.5         -10.26%
2017-06-25 15:17:49 -07:00
Olivier Poitrey 9c5f03507d Add some json encoder benchmarks 2017-06-25 15:17:49 -07:00
Olivier Poitrey 15fc33fe89 Fix sloppy test 2017-06-25 01:12:41 -07:00
Olivier Poitrey b42b460ec6 Update bench 2017-06-23 20:37:30 -07:00
Josh Baker f8aa7a1962 Optimistically expect simple strings for json (#6)
Performance update to appendJSONString so that it now checks if
the input is a simple string that contains no json delimiters, control
characters, or unicode. If simple then the operation is only three
appends. [double-quote, string, double-quote].

If a non-simple character is encountered then all of the previous
characters are appended and the operation falls back to the original
method for the remaining characters.

Before:

  BenchmarkLogEmpty-8	    100000000	        17.1 ns/op
  BenchmarkDisabled-8	    500000000	         4.12 ns/op
  BenchmarkInfo-8		    20000000	       101 ns/op
  BenchmarkContextFields-8    20000000	       105 ns/op
  BenchmarkLogFields-8	     5000000	       281 ns/op

After:

  BenchmarkLogEmpty-8	    100000000	        16.7 ns/op
  BenchmarkDisabled-8	    500000000	         3.79 ns/op
  BenchmarkInfo-8		    30000000	        44.8 ns/op
  BenchmarkContextFields-8    30000000	        67.5 ns/op
  BenchmarkLogFields-8	    10000000	       197 ns/op
2017-06-23 20:28:33 -07:00
Olivier Poitrey 2e3da1d5b5 Always place timestamp as first field for better log readability 2017-06-08 10:12:49 -07:00
Olivier Poitrey 2a829377cb Rename warning field to warn in the output 2017-06-08 10:03:03 -07:00
Olivier Poitrey 9889521807 Add TimeDiff event method 2017-06-06 22:10:36 -07:00
Olivier Poitrey 3f6ca6688c Fix Fatal and Panic not terminating to program 2017-06-06 10:23:34 -07:00
Olivier Poitrey 46cd35d1f2 Remove error returned by Msg and Msgf
When error happen, there is nothing the caller can really do and it is
not practicle to handle logging errors. Print an error on the standard
error instead.
2017-06-06 10:10:31 -07:00
Olivier Poitrey 95ecd5ad27 Fix Log level 2017-06-05 13:03:55 -07:00
Olivier Poitrey 7e8bba7e7f Fix typos 2017-06-05 13:03:55 -07:00
Olivier Poitrey 397b56dc9d Use defer when expected 2017-06-05 12:43:37 -07:00
Olivier Poitrey 49d553c9b8 Add AnErr field type 2017-06-02 00:56:14 -07:00
Olivier Poitrey 67803eb791 Add Nop constructor 2017-06-02 00:24:52 -07:00
Olivier Poitrey 6bcd15ecf0 Add support for zerolog as an output for stdlib logger 2017-06-01 23:17:28 -07:00
Olivier Poitrey bf4b44614c Simplify Dur method usage. 2017-05-20 21:08:42 -07:00
Olivier Poitrey e0e86f933f Add Msgf test 2017-05-20 20:59:39 -07:00
Olivier Poitrey 6b56a13287 Add a mention about humanlog 2017-05-20 19:50:05 -07:00
Joey Geiger 6fbe7ae422 Fix Typos in Readme (#4)
The word referrer was also incorrect, but it may need a code change.
2017-05-20 19:28:55 -07:00
Olivier Poitrey 606506fd35 Merge pull request #3 from wjh/patch-1
Fix alice URL
2017-05-20 11:55:25 -07:00
Will Huxtable 2af75c68e6 Fix URL
The link to alice was invalid, just missing the protocol.
2017-05-20 11:32:00 +01:00