summaryrefslogtreecommitdiff
path: root/lib/chef/chef_class.rb
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-09-01 13:21:02 -0700
committerJohn Keiser <john@johnkeiser.com>2015-09-01 19:30:51 -0700
commitf975355dc9cb9ef73ff86471a32bfac459efeb7a (patch)
tree32b4254108a03359934d1da1a4e7e7822086ab87 /lib/chef/chef_class.rb
parent386468df5441f4a75865bccfd9314f883e5f39ff (diff)
downloadchef-f975355dc9cb9ef73ff86471a32bfac459efeb7a.tar.gz
Rename log.deprecation to log_deprecation
Diffstat (limited to 'lib/chef/chef_class.rb')
-rw-r--r--lib/chef/chef_class.rb27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/chef/chef_class.rb b/lib/chef/chef_class.rb
index e825bedb34..c2cb9e2b24 100644
--- a/lib/chef/chef_class.rb
+++ b/lib/chef/chef_class.rb
@@ -192,19 +192,26 @@ class Chef
end
#
- # @overload log
- # Get the current log object.
+ # Emit a deprecation message.
#
- # @return An object that supports `deprecation(message)`
+ # @param message The message to send.
+ # @param location The location. Defaults to the caller who called you (since
+ # generally the person who triggered the check is the one that needs to be
+ # fixed).
#
# @example
- # run_context.log.deprecation("Deprecated!")
- #
- # @api private
- def log
- # `run_context.events` is the primary deprecation target if we're in a run. If we
- # are not yet in a run, print to `Chef::Log`.
- (run_context && run_context.events) || Chef::Log
+ # Chef.deprecation("Deprecated!")
+ #
+ # @api private this will likely be removed in favor of an as-yet unwritten
+ # `Chef.log`
+ def log_deprecation(message, location=caller(2..2)[0])
+ # `run_context.events` is the primary deprecation target if we're in a
+ # run. If we are not yet in a run, print to `Chef::Log`.
+ if run_context && run_context.events
+ run_context.events.deprecation(message, location)
+ else
+ Chef::Log.deprecation(message, location)
+ end
end
end