Commit Graph

17 Commits

Author SHA1 Message Date
Zephaniah Loss-Cutler-Hull 4de2fcc128
Fix handling of printing caller with Write, Print, and Printf. (#315)
* Add event.CallerSkipFrame(skip int)

This indicates that, for this event, we should skip an additional
specified number of frames.

This is cumulative, calling it twice for the same event will add both
numbers together, and this is in addition to any skip frame settings set
through the context, or globally.

The indended purpose is for wrappers to Msg or Msgf, so that the actual
caller is always printed correctly.

* Use CallerSkipFrame for Print, Printf, and Write.

This allows us to use the correct caller when using these 3 functions.

Co-authored-by: Zephaniah E. Loss-Cutler-Hull <warp@aehallh.com>
2021-05-13 17:22:27 +02:00
Olivier Poitrey 5d9d7660cc Expose the Err helper from the global logger 2019-11-18 16:22:50 -08:00
CrazyMax 4502cc1942 Add TraceLevel (#158) 2019-11-04 11:39:22 -08: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
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
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
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
Olivier Poitrey 8c682b3b12 Add Print and Printf top level methods 2017-09-01 19:59:48 -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 9e5c06cf0e Add more advanced sampling modes 2017-08-28 23:30:54 -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 3f54be8716 Improve context.Context logging 2017-05-20 00:22:37 -07:00
Olivier Poitrey d0cfcbbafe Write directly into a single shared buffer per event for even better perf 2017-05-19 19:45:46 -07:00
Olivier Poitrey 7f302b00ec Initial commit 2017-05-13 16:22:35 -07:00