Created
April 19, 2018 06:24
-
-
Save rondinif/dbe240bfe038f6286422928556dd8f43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see: https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html | |
LOGLEVELS = %w[DEBUG INFO WARN ERROR FATAL UNKNOWN].freeze | |
LOGGER = Logger.new(STDOUT) | |
level ||= LOGLEVELS.index ENV.fetch("LOG_LEVEL","WARN") # default to WARN index: 2 | |
level ||= Logger::WARN # FIX default in case of environment LOG_LEVEL value is present but not correct | |
LOGGER.level = level | |
# Usage: | |
# before launching the program: | |
# $ export LOG_LEVEL=DEBUG | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment