-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from dyweb/log/v2.5/init
[log] Refactor and measure performance using benchmark - reduce handler interface to 2 methods, previously there was 7 for the sake of better performance - use logger registry and only maintain tree for special loggers Fix #33 Fix #78 - allow set caller skip Fix #86 - support escape string in json handler - add benchmark, mainly modeled after zap Fix #88
- Loading branch information
Showing
107 changed files
with
4,492 additions
and
757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
vendor | ||
coverage.txt | ||
coverage.txt | ||
gommon-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ sudo: false | |
|
||
go: | ||
- "1.10" | ||
- "1.11" | ||
- tip | ||
|
||
install: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Changelog | ||
|
||
## 2018-12-08 | ||
|
||
- remove logger relation ship from logger struct, use logger registry instead | ||
|
||
## 2018-11-25 | ||
|
||
- reduce `Handler` interface method from 6 to 1, just a `HandleLog(level Level, now time.Time, msg string, source string, context Fields, fields Fields)` | ||
- add `Print`, `Printf` for drop in replacement of standard library like non leveled logging library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.out | ||
# binary generated for profile | ||
*.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# TODO: the dependency is from global go path ... | ||
bench: | ||
go test -run none -bench . -benchtime 3s -benchmem -memprofile p.out | ||
bench-gommon: | ||
go test -run none -bench=".*/gommon" -benchtime 3s -benchmem -memprofile p.out | ||
bench-gommon-no-fields: | ||
go test -run none -bench="BenchmarkWithoutFieldsText/gommon.F" -benchtime 3s -benchmem -memprofile p.out | ||
bench-gommon-no-context-with-fields: | ||
go test -run none -bench="BenchmarkNoContextWithFieldsJSON/gommon.F" -benchtime 3s -benchmem -memprofile p.out | ||
pprof-ui: | ||
# TODO: need to give it binary path otherwise it will throw error | ||
go tool pprof -http=:8080 p.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Benchmark | ||
|
||
## Log libraries | ||
|
||
- [ ] TODO: k8s fork for glog https://github.com/kubernetes/klog , | ||
they are also considering parent children logger https://github.com/kubernetes/klog/issues/22 | ||
|
||
## Ref | ||
|
||
- zap https://github.com/uber-go/zap/tree/master/benchmarks | ||
- first clone and put the repo to $GOPATH/src/go.uber.org/zap they are not using github repo as import path | ||
- zerolog https://github.com/rs/logbench | ||
- https://hackernoon.com/does-logging-cause-cpu-load-a-test-of-all-the-golang-logging-libraries-34052240f90d | ||
- it starts a http server to log and use a client to hit the server | ||
- [x] it measure system call using `sudo strace -c -t -p $(pid)` and see context switches | ||
- https://medium.com/justforfunc/analyzing-the-performance-of-go-functions-with-benchmarks-60b8162e61c6 |
Oops, something went wrong.