inconshreveable/log15 — pull request #20 by gtrevg (2014-07-31 00:24:27+00:00)
Title: Implement the suggestions as described in issue #4

I went through the code and implemented the changes that you had suggested in issue #4. I ended up making a second structure for the KeyNames so as to make initialization of the record easier. This update allows someone to write a handler such as:

```
func MyLogFmtHandler(h log.Handler) log.Handler {
return log.FuncHandler(func(r *log.Record) error {
r.KeyNames.Msg = "log_message"
r.KeyNames.Lvl = "log_level"
r.KeyNames.Time = "log_timestamp"

return h.Log(r)
})
}
```
and then invoke it by doing something like:
```
logger.SetHandler(MyLogFmtHandler(log.StreamHandler(os.Stdout, log.LogfmtFormat())))
```

I did some benchmarking on this new version versus the old version. I found that the `BenchmarkJsonNoCtx` benchmark got significantly faster: 4754 ns/op --> 1616 ns/op.

```
PASS
BenchmarkStreamNoCtx 500000 3856 ns/op
BenchmarkDiscard 10000000 170 ns/op
BenchmarkLinenum 2000000 782 ns/op
BenchmarkLogfmtNoCtx 500000 3530 ns/op
BenchmarkJsonNoCtx 500000 4754 ns/op
BenchmarkMultiLevelFilter 10000000 198 ns/op
ok	github.com/inconshreveable/log15	12.641s
```
versus
```
PASS
BenchmarkStreamNoCtx 500000 3835 ns/op
BenchmarkDiscard 10000000 193 ns/op
BenchmarkLinenum 2000000 803 ns/op
BenchmarkLogfmtNoCtx 500000 3525 ns/op
BenchmarkJsonNoCtx 1000000 1616 ns/op
BenchmarkMultiLevelFilter 10000000 220 ns/op
ok	github.com/gtrevg/log15	12.375s
```