Is there any good wrapper available for level based logging in golang? If not, how should I go about implementing one myself?
What I want is pretty simple. I want a
I am working with rlog at the moment and like their approach. The code looks good, simplistic and sufficiently documented.
What convinced me:
rlog.Info()
anywhere without passing around referencesrlog.Trace(4, "foo")
I think seelog fits your requirements, and it seems to be pretty popular as it pops up often in log discussions. I never used it seriously, so I can't comment beyond that.
https://github.com/hashicorp/logutils I found this to be very easy to use and you don't even need to change the method calls to log.Printf
of the std library.
Here's a nice article, that basically says that you don't need level based logging. I feel that it's maybe too opinionated, but it also worths to read a different perspective.
You can use the module midlog to implements any other log library, https://github.com/lingdor/midlog