summaryrefslogtreecommitdiff
path: root/lib/chef/formatters/base.rb
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-06-14 18:39:14 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-14 18:39:14 -0700
commitd98d35448da139c5c039f810f5cb9c86094f695b (patch)
tree32a7af49b4919fc8a148690780f18d26ff4eb79b /lib/chef/formatters/base.rb
parentaa4f3285f3e49919e29f40337183fd0510baaee5 (diff)
downloadchef-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.rb15
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)