Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the user to customize the stack depth to skip. #128

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Allow the user to customize the stack depth to skip. #128

wants to merge 8 commits into from

Conversation

xgfone
Copy link

@xgfone xgfone commented Apr 6, 2017

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.

@notzippy
Copy link
Contributor

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

@xgfone
Copy link
Author

xgfone commented Aug 31, 2017

@notzippy Yes, you are right.

I have merged it from Revel

@xgfone xgfone mentioned this pull request Aug 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants