Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously using `l.SetHeader("")` would panic with: --- FAIL: TestEmptyHeader (0.00s) panic: runtime error: index out of range [-1] [recovered] panic: runtime error: index out of range [-1] goroutine 18 [running]: github.com/labstack/gommon/log.(*Logger).log(0xc00014e990, 0x1, {0x5fb505, 0xd}, {0x0, 0x0, 0x0}) /home/martin/src/gommon/log/log.go:394 +0x615 github.com/labstack/gommon/log.(*Logger).Debugf(...) /home/martin/src/gommon/log/log.go:158 github.com/labstack/gommon/log.TestEmptyHeader(0xc000129860?) /home/martin/src/gommon/log/log_test.go:128 +0xb1 This adds a check for that. It also checks if there is any content before writing a space in the "Text header" else branch so you don't end up with " my message".
- Loading branch information