I found Some log framework for golang in github.com. Logrus is the one which is recommended by many developers.But It does not have filtering log levels. Can anyone suggest me a log framework with the mentioned features and that should be suitable for production?
According to the Logrus documentation you can "filter" log levels for dispatching it or not logging it. See level logging and Hooks part of the README.md on Logrus' github repository.
If you want another one, seelog is what I use on some project. Highly configurable it should suit your needs.
I have just implemented this thing, if you are interested in doing so yourself, here is what I wrote:
type LoggingLevels int
const (
Debug LoggingLevels = iota
Info
Warning
Error
Critical
)
before calling the log func (debug in this example):
if Debug < log.LogLevel {// call func here}
I hope it's helping!