log15
log15 copied to clipboard
Allow the user to customize the stack depth to skip.
This PR removes the hard-coded stack depth to skip. So the user can customize it by the actual demand.
For example, I want to wrap log15.Logger in my struct.
type MyStruct struct {
logger *log15.Logger
// Other fields
// ...
}
func (m *MyStruct) LogInfo(msg string) {
m.logger.Info(msg)
}
my := MyStruct{
logger: log15.New().SetStackDepth(1)
}
my.LogInfo("test")
Before this, I have to discard the stack information of log15.Logger and rewrite it myself.
Two things missing on this PR
- [ ] The SetStackDepth is not declared in the interface, therefore is not exposed
- [ ] On the
Newcreation you should set the currentStackDepthnot use thedefaultStackDepth
My additional changes for Revel