Skip to content

[feature] Introduce new %{callpath} format keyword #85

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

Merged
merged 1 commit into from
Feb 6, 2016

Conversation

nplanel
Copy link
Contributor

@nplanel nplanel commented Feb 5, 2016

%{callpath} aim to print the callers stack as a call path.

Output exmaples :
main.a.b.c
main.a.b.c...c

"..." stand for recursive call

%{callpath} aim to print the callers stack as a call path.

Output exmaples :
main.a.b.c
main.a.b.c...c

"..." stand for recursive call
@op
Copy link
Owner

op commented Feb 6, 2016

@nplanel Nifty! Feels like you'd want to limit the stack trace in most applications though.

op added a commit that referenced this pull request Feb 6, 2016
[feature] Introduce new %{callpath} format keyword
@op op merged commit f62e8e0 into op:master Feb 6, 2016
@nplanel
Copy link
Contributor Author

nplanel commented Feb 7, 2016

Thanks,
Yes I think it would be good to limit it by an argument, like %{callpath:5} last 5 callers

I was thinking about introduce another patch like to print extra information based on the level, ex:
%{pid:DEBUG} would be print if the module level is set to DEBUG even if the format is specified in an log.Info().
The Idea is to be more verbose on specific message, when you are in production and you would like more info when debugging in production.

What do think about ?

@op
Copy link
Owner

op commented Feb 11, 2016

@nplanel The idea tickles my interest but maybe it would be nicer to have separate formatters per log level? I hope that should be possible to create by combining the existing infrastructure.

@nplanel
Copy link
Contributor Author

nplanel commented Feb 15, 2016

@op After re-thinking I think using different formatters (on the app side) is the right way to do so.

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.

2 participants