summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsawanoboly <sawanoboriyu@higanworks.com>2015-04-23 15:32:53 +0900
committerLamont Granquist <lamont@scriptkiddie.org>2015-05-06 15:09:44 -0700
commit3c5f6827558a50581395df22509ad7ad728a1625 (patch)
tree0a474c9c10c3ef14c72c95b547f1cc233ac073a1
parent9a0f9d284424f9d38edc3df184271492dd8f2472 (diff)
downloadchef-3c5f6827558a50581395df22509ad7ad728a1625.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