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

unable to control stack depth shown by logger #597

Open
tharvik opened this issue Oct 31, 2019 · 0 comments
Open

unable to control stack depth shown by logger #597

tharvik opened this issue Oct 31, 2019 · 0 comments

Comments

@tharvik
Copy link
Contributor

tharvik commented Oct 31, 2019

Currently, log.lvl uses a skip argument to select how many stackframes to drop. log.lvl{d,f} both set it at 3 before forwarding the call. Sadly, there is no way to set the relevant call depth from the outside. That's useful in order to provide preciser logging: sometimes, you want all the logger's call in a given function to prepend some identification string, which can be easily done by having some logger oneliner in the preamble; depending on how much a project using onet grows, it usually wants to build a logger upon the existing logging infrastracture, so, control over skip would be nice.

One trivial (but wrong) fix would be to have a var Skip uint in the log pkg, but as it is shared by everyone, some other parts might except a certain skip value, not the one you set.

Using a logger object, providing an interface similar to the one existing would allow for this use case separation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant