log15 icon indicating copy to clipboard operation
log15 copied to clipboard

Allow the user to customize the stack depth to skip.

Open xgfone opened this issue 8 years ago • 2 comments

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.

xgfone avatar Apr 06 '17 04:04 xgfone

Two things missing on this PR

  • [ ] The SetStackDepth is not declared in the interface, therefore is not exposed
  • [ ] On the New creation you should set the current StackDepth not use the defaultStackDepth

My additional changes for Revel

notzippy avatar Aug 31 '17 14:08 notzippy

@notzippy Yes, you are right.

I have merged it from Revel

xgfone avatar Aug 31 '17 15:08 xgfone