lib/convenient_service/logger.rb in convenient_service-0.17.0 vs lib/convenient_service/logger.rb in convenient_service-0.18.0

- old
+ new

@@ -34,14 +34,22 @@ # - https://github.com/ruby/logger/blob/v1.2.8.1/lib/logger.rb#L740 # - https://github.com/ruby/logger/blob/v1.5.3/lib/logger.rb#L651 # - https://github.com/ruby/logger/blob/v1.5.3/lib/logger.rb#L397 # # TODO: Specs for `super(::STDOUT)`. + # TODO: Warning and fallback when `CONVENIENT_SERVICE_LOGGER_LEVEL` is NOT valid. # # rubocop:disable Style/GlobalStdStream def new super(::STDOUT).tap do |logger| - logger.level = ::ENV["CONVENIENT_SERVICE_LOGGER_LEVEL"] || ::Logger::INFO + logger.level = + if ::ENV["CONVENIENT_SERVICE_DEBUG"] == "true" + ::Logger::DEBUG + elsif ::ENV["CONVENIENT_SERVICE_LOGGER_LEVEL"] + ::ENV["CONVENIENT_SERVICE_LOGGER_LEVEL"] + else + ::Logger::INFO + end logger.formatter = (::ENV["CONVENIENT_SERVICE_LOGGER_ENABLE_COLORS"] == "true") ? colored_formatter : original_formatter end end # rubocop:enable Style/GlobalStdStream