lib/ruby_dep/warning.rb in ruby_dep-1.4.0 vs lib/ruby_dep/warning.rb in ruby_dep-1.5.0
- old
+ new
@@ -25,11 +25,10 @@
NOTICE_OPEN_ISSUE = 'If you need this version supported,'\
" please open an issue at #{PROJECT_URL}".freeze
def initialize
@version = RubyVersion.new(RUBY_VERSION, RUBY_ENGINE)
- @logger = Logger.new(STDERR, PREFIX)
end
def show_warnings
return if silenced?
return warn_ruby(WARNING[status]) if WARNING.key?(status)
@@ -51,12 +50,14 @@
def status
@version.status
end
def warn_ruby(msg)
- @logger.warning(msg)
- @logger.notice(recommendation)
- @logger.notice(NOTICE_HOW_TO_DISABLE)
+ RubyDep.logger.tap do |logger|
+ logger.warn(PREFIX + msg)
+ logger.info(PREFIX + recommendation)
+ logger.info(PREFIX + NOTICE_HOW_TO_DISABLE)
+ end
end
def recommendation
return unrecognized_msg unless @version.recognized?
return recommendation_msg unless status == :insecure