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

example for changing logging level by public function, called with HT… #18

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

Conversation

noreabu
Copy link

@noreabu noreabu commented Sep 25, 2017

…TP GET handler in gin-gonic

I hope this time the account name is ok...

It could be refactored in a way, so that log and trace level could be changed by a public rlog function instead of changing the config file. But that would require changes to the rlog code.

@jbrendel
Copy link
Contributor

jbrendel commented Nov 5, 2017

Hello! I'm just going through some older PRs, trying to merge them into rlog. I would like to include your example, but do you think it's possible to have a main() function in there, so that it can be started like the other example with something like go run examples/setLogLevelsViaGetRequest.go , or similar?

@noreabu noreabu closed this Nov 13, 2017
@noreabu noreabu reopened this Nov 13, 2017
@noreabu
Copy link
Author

noreabu commented Nov 13, 2017

i am pretty new to this. hope i got it right.

@jbrendel
Copy link
Contributor

This is better. However, considering that this gives you a chance to change the log level with a GET request, it would be great if the main function could show that: Run/install the handler function, and at the same time - in an endless loop - provide an ongoing "once a second" output of a few lines with a certain log or trace level. Then the user could issue a 'wget' or 'curl' request to the URL and see how the ongoing output changes. The main function should print a starting message explaining the URL and the parameters.

That would be a neat demo.

@noreabu
Copy link
Author

noreabu commented Nov 14, 2017

you are right, that would be are very nice demo indeed. I'll look into it later and see if i can adapt it to the net/http package instead of gin-gonic.

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