summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsawanoboly <sawanoboriyu@higanworks.com>2015-04-23 15:32:53 +0900
committerLamont Granquist <lamont@scriptkiddie.org>2015-05-04 15:57:11 -0700
commit15ab07cbbd88f6974fb71bd46f63d060ef81a4b6 (patch)
tree18a112905da3119ce3d67c31daae6691bfcd1b73
parentbbf1d098e1b49882094beb68c6078b5f6b7a242d (diff)
downloadchef-15ab07cbbd88f6974fb71bd46f63d060ef81a4b6.tar.gz
fallback to info
-rw-r--r--lib/chef/log.rb2
-rw-r--r--spec/unit/log_spec.rb5
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/chef/log.rb b/lib/chef/log.rb
index d11e16b1f3..0835a9f2c5 100644
--- a/lib/chef/log.rb
+++ b/lib/chef/log.rb
@@ -42,6 +42,8 @@ class Chef
def write(message)
data = message.match(/(\[.+?\]) ([\w]+):(.*)$/)
self.send(data[2].downcase.to_sym, data[3])
+ rescue NoMethodError
+ self.send(:info, message)
end
def close
diff --git a/spec/unit/log_spec.rb b/spec/unit/log_spec.rb
index 54e0c940b4..756e5b43e0 100644
--- a/spec/unit/log_spec.rb
+++ b/spec/unit/log_spec.rb
@@ -35,4 +35,9 @@ describe Chef::Log::Syslog do
expect_any_instance_of(Logger::Syslog).to receive(:warn).with(" No config file found or specified on command line, using command line options.")
logger.write("[2015-04-23T15:16:20+09:00] WARN: No config file found or specified on command line, using command line options.")
end
+
+ it "should fallback into send message with severity info to syslog when wrong format." do
+ expect_any_instance_of(Logger::Syslog).to receive(:info).with("chef message")
+ logger.write("chef message")
+ end
end