romana / rlog

A simple Golang logger without external dependencies
Apache License 2.0
39 stars 14 forks source link

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

Open noreabu opened 7 years ago

noreabu commented 7 years ago

…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 commented 7 years ago

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 commented 7 years ago

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

jbrendel commented 7 years ago

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 commented 6 years ago

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.