Skip to content

Log refactor

Compare
Choose a tag to compare
@at15 at15 released this 09 Dec 09:06
· 100 commits to master since this release

closed issues

  • reduce handler interface from 6 methods to 1
  • #88 add benchmark
  • #33 #78 use log registry to keep tree of logger
  • escape string in json handler
  • #87 add multi handler for fan out

The main takeaway for the benchmarks are

  • reduce number of alloc by allocate enough size in one call, it will reduce cpu time as well
  • pass bytes slice all the way down the call stack to reduce alloc
  • use interface methods cause parameters escape to heap, even buffer pool can't help you with that unless you eliminate interface use down the entire call stack
  • you can still get good performance without using pool, logrus is using pool, but its performance is extremely poor