Tabitha
19c98f6d3e
If LevelFieldName is empty don't log level ( #313 )
2021-05-05 14:40:45 +02:00
Dan Gillis
582f0cf0e3
add Disabled to String and ParseLevel; add tests ( #307 )
2021-04-13 07:32:06 +02:00
Eugene
9e51190d47
Fix some tests ( #245 )
...
* TestUpdateEmptyContext for CBOR
* Properly name CBOR 64 bit tests
2020-06-25 14:48:07 -07:00
Eugene
1b763497ee
Fix UpdateContext panic with empty Context ( #244 )
2020-06-24 16:11:26 -07:00
Chris Camel
7248ae2fb4
add stringer support for sub-logger ( #241 )
...
Same than #185 but for zerolog.Context.
2020-06-17 20:42:03 -07:00
Dima
7825d86337
stringer event method ( #185 )
2020-05-28 10:43:18 -07:00
CrazyMax
4502cc1942
Add TraceLevel ( #158 )
2019-11-04 11:39:22 -08:00
Veselkov Konstantin
33a4561a07
remove golint errors ( #187 )
2019-10-04 07:31:06 -07:00
wangyuehong
60d4b07b61
Add GetLevel method ( #161 )
2019-06-20 16:44:55 -07:00
Mike Camp
651d361cfe
Add CallerWithSkipFrameCount to the Context ( #98 ) ( #135 )
...
Add the ability to skip a specified number of stack frames
on a per context basis. Before this toe CallerSkipFrameCount
could only be set globally.
2019-03-04 16:41:18 -08:00
Soloman Weng
8e5449ab35
Allow using custom level field format ( #136 )
2019-03-01 16:08:23 -08:00
mikeyrcamp
299ff038c1
Add support for customizing caller field format ( #133 ) ( #134 )
2019-02-20 11:39:29 -08:00
Olivier Poitrey
8747b7b3a5
Add ErrorHandler global to allow handling of write errors
2018-11-20 10:56:21 -08:00
anthony
baa31cfa85
Fix nil pointer dereference when call Fields with a typed nil value ( #112 )
2018-10-31 10:40:46 -07:00
Olivier Poitrey
20ad1708e7
Fix nil pointer exception on Discard when called with nil logger
...
Fixes #108
2018-09-26 09:52:52 -07:00
Olivier Poitrey
1dde226d45
BasicSampler prints first message ( fix #104 )
2018-09-16 15:54:54 -07:00
Dušan Kasan
1c6d99b455
Add custom error serialization support and provide sane defaults ( #78 )
...
As per https://github.com/rs/zerolog/issues/9 and to offer a different approach from https://github.com/rs/zerolog/pull/11 and https://github.com/rs/zerolog/pull/35 this PR introduces custom error serialization with sane defaults without breaking the existing APIs.
This is just a first draft and is missing tests. Also, a bit of code duplication which I feel could be reduced but it serves to get the idea across.
It provides global error marshalling by exposing a `var ErrorMarshalFunc func(error) interface{}` in zerolog package that by default is a function that returns the passed argument. It should be overriden if you require custom error marshalling.
Then in every function that accept error or array of errors `ErrorMarshalFunc` is called on the error and then the result of it is processed like this:
- if it implements `LogObjectMarshaler`, serialize it as an object
- if it is a string serialize as a string
- if it is an error, serialize as a string with the result of `Error()`
- else serialize it as an interface
The side effect of this change is that the encoders don't need the `AppendError/s` methods anymore, as the errors are serialized directly to other types.
2018-07-02 12:46:01 -07:00
Olivier Poitrey
a572c9d1f6
Add missing support for zerolog marshable objects to Fields
2018-05-09 03:52:30 -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
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
d0ca9bbceb
Add support for pointer values in Fields
...
Fixes #46
2018-03-25 20:18:47 -07:00
Max Wolter
1c575db928
Add support for hex-encoded of byte slice ( #42 )
2018-03-15 10:29:26 -07:00
Olivier Poitrey
56a970de51
Add RawJSON field type
2018-02-12 16:05:27 -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
Rodrigo Coelho
c3d02683c7
Add hook support ( #24 )
2017-12-01 10:52:37 -07: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
9e5c06cf0e
Add more advanced sampling modes
2017-08-28 23:30:54 -07:00
Olivier Poitrey
2aa3c3ae4f
Add some array types support
2017-07-25 12:50:35 -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
15fc33fe89
Fix sloppy test
2017-06-25 01:12:41 -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
49d553c9b8
Add AnErr field type
2017-06-02 00:56:14 -07:00
Olivier Poitrey
e0e86f933f
Add Msgf test
2017-05-20 20:59:39 -07:00
Olivier Poitrey
19a9a81cd2
Add some more doc
2017-05-20 02:22:57 -07:00
Olivier Poitrey
156a4e8b0f
Use TimeFieldFormat for Timestamp field
2017-05-19 22:14:51 -07:00
Olivier Poitrey
fa2d76dd80
Add some test
2017-05-19 21:57:46 -07:00
Olivier Poitrey
5ebf00efab
Add dict support
2017-05-18 00:10:45 -07:00
Olivier Poitrey
aff9804294
Test fields and context
2017-05-16 22:24:36 -07:00
Olivier Poitrey
7f302b00ec
Initial commit
2017-05-13 16:22:35 -07:00