diff options
Diffstat (limited to 'chef')
-rw-r--r-- | chef/lib/chef/provider/log.rb | 2 | ||||
-rw-r--r-- | chef/lib/chef/resource/log.rb | 11 | ||||
-rw-r--r-- | chef/spec/unit/resource/log_spec.rb | 9 |
3 files changed, 20 insertions, 2 deletions
diff --git a/chef/lib/chef/provider/log.rb b/chef/lib/chef/provider/log.rb index 5d0417ebda..927ee72fcc 100644 --- a/chef/lib/chef/provider/log.rb +++ b/chef/lib/chef/provider/log.rb @@ -38,7 +38,7 @@ class Chef # === Return # true:: Always return true def action_write - Chef::Log.send(@new_resource.level, @new_resource.name) + Chef::Log.send(@new_resource.level, @new_resource.message) @new_resource.updated_by_last_action(true) end diff --git a/chef/lib/chef/resource/log.rb b/chef/lib/chef/resource/log.rb index d1b6b5af0b..30a5bb93c6 100644 --- a/chef/lib/chef/resource/log.rb +++ b/chef/lib/chef/resource/log.rb @@ -20,7 +20,7 @@ class Chef class Resource class Log < Chef::Resource - identity_attr :name + identity_attr :message # Sends a string from a recipe to a log provider # @@ -47,6 +47,15 @@ class Chef @resource_name = :log @level = :info @action = :write + @message = name + end + + def message(arg=nil) + set_or_return( + :message, + arg, + :kind_of => String + ) end # <Symbol> Log level, one of :debug, :info, :warn, :error or :fatal diff --git a/chef/spec/unit/resource/log_spec.rb b/chef/spec/unit/resource/log_spec.rb index bc5ac13078..4c6b2c122d 100644 --- a/chef/spec/unit/resource/log_spec.rb +++ b/chef/spec/unit/resource/log_spec.rb @@ -38,6 +38,15 @@ describe Chef::Resource::Log do it "should allow you to set a log string" do @resource.name.should == @log_str end + + it "should set the message to the first argument to new" do + @resource.message.should == @log_str + end + + it "should accept a string for the log message" do + @resource.message "this is different" + @resource.message.should == "this is different" + end it "should accept a vaild level option" do @resource.level :debug |