summaryrefslogtreecommitdiff
path: root/lib/chef/chef_class.rb
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-08-31 14:38:50 -0700
committerJohn Keiser <john@johnkeiser.com>2015-09-01 19:30:43 -0700
commit25dac92eeb1ffa83ec549bfed0b19672c5847d80 (patch)
treef5292bfb261d40f1bbe3bdfa2845de87245f78d4 /lib/chef/chef_class.rb
parentad8fd4d65b48519ac154ad9bf9774322b0c6d902 (diff)
downloadchef-25dac92eeb1ffa83ec549bfed0b19672c5847d80.tar.gz
Pass deprecations through formatter instead of logs
Diffstat (limited to 'lib/chef/chef_class.rb')
-rw-r--r--lib/chef/chef_class.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/chef/chef_class.rb b/lib/chef/chef_class.rb
index 458ac82467..e825bedb34 100644
--- a/lib/chef/chef_class.rb
+++ b/lib/chef/chef_class.rb
@@ -190,6 +190,22 @@ class Chef
def resource_handler_map
@resource_handler_map ||= Chef::Platform::ResourceHandlerMap.instance
end
+
+ #
+ # @overload log
+ # Get the current log object.
+ #
+ # @return An object that supports `deprecation(message)`
+ #
+ # @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
+ end
end
reset!