diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2018-06-14 18:39:14 -0700 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2018-06-14 18:39:14 -0700 |
commit | d98d35448da139c5c039f810f5cb9c86094f695b (patch) | |
tree | 32a7af49b4919fc8a148690780f18d26ff4eb79b /lib/chef/formatters/base.rb | |
parent | aa4f3285f3e49919e29f40337183fd0510baaee5 (diff) | |
download | chef-d98d35448da139c5c039f810f5cb9c86094f695b.tar.gz |
Simplify the deprecations system a bit, and introduce ways to silence deprecation warnings.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'lib/chef/formatters/base.rb')
-rw-r--r-- | lib/chef/formatters/base.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/chef/formatters/base.rb b/lib/chef/formatters/base.rb index 0b27b55048..997577aa7b 100644 --- a/lib/chef/formatters/base.rb +++ b/lib/chef/formatters/base.rb @@ -212,14 +212,13 @@ class Chef file_load_failed(path, exception) end - def deprecation(message, location = caller(2..2)[0]) - out = if is_structured_deprecation?(message) - message.inspect - else - "#{message} at #{location}" - end - - Chef::Log.deprecation(out) + # Log a deprecation warning object. + # + # @param deprecation [Chef::Deprecated::Base] Deprecation object to log. + # In previous versions, this could be a string. Don't do that anymore. + # @param location [Object] Unused, present only for compatbility. + def deprecation(deprecation, _location = nil) + Chef::Log.deprecation(deprecation.to_s) unless deprecation.silenced? end def is_structured_deprecation?(deprecation) |