github.com/baijum/logger

Go package to set log level


License
MIT
Install
go get github.com/baijum/logger

Documentation

Levels for logging

GoDoc Go Report Card MIT License Build Status

To get package:

go get github.com/baijum/logger

Environment variable "LOG_LEVEL" set the log level. These are the possible values: DEBUG, INFO, WARNING, and ERROR

Log level can be set from the code like this:

logger.SetLevel(logger.WARNING)

To log a message, compare the current level with available levels:

if logger.Level <= logger.INFO {
    log.Printf("Some log message")
}

if logger.Level <= logger.WARNING {
    log.Printf("Some log message")
}