[chef] Re: Using the 'log' resource vs Chef::Log.


Chronological Thread 
  • From: Daniel DeLeo < >
  • To:
  • Subject: [chef] Re: Using the 'log' resource vs Chef::Log.<loglevel>
  • Date: Mon, 8 Jul 2013 08:48:27 -0700


On Monday, July 8, 2013 at 8:30 AM, Mike wrote:

Ohai,

I am trying to understand the differences between:

log 'Here's a log line'

and:

Chef::Log.info 'Here's another log line'

from a Chef internals perspective.

Can anyone shed any pros/cons of either?

The log resource eventually calls Chef::Log. The big difference is timing; a direct call to Chef::Log is just ruby that's executed in the compile phase, while the resource version is added to the resource collection and then gets processed in the converge phase. As a resource, you're also able to notify it from other resources.
 
Thanks,
-M


-- 
Daniel DeLeo




Archive powered by MHonArc 2.6.16.

§