summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsawanoboly <sawanoboriyu@higanworks.com>2015-04-23 16:37:31 +0900
committerLamont Granquist <lamont@scriptkiddie.org>2015-05-06 15:09:44 -0700
commit8a5d5a7501bb6763e2dc65c8874aff5a1d5e9d50 (patch)
tree0281d860e1bff8a489fda007214c21437621fa79
parent3c5f6827558a50581395df22509ad7ad728a1625 (diff)
downloadchef-8a5d5a7501bb6763e2dc65c8874aff5a1d5e9d50.tar.gz
strip message
-rw-r--r--lib/chef/log.rb2
-rw-r--r--spec/unit/log_spec.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/log.rb b/lib/chef/log.rb
index 0835a9f2c5..2dd2896fd9 100644
--- a/lib/chef/log.rb
+++ b/lib/chef/log.rb
@@ -41,7 +41,7 @@ class Chef
def write(message)
data = message.match(/(\[.+?\]) ([\w]+):(.*)$/)
- self.send(data[2].downcase.to_sym, data[3])
+ self.send(data[2].downcase.to_sym, data[3].strip)
rescue NoMethodError
self.send(:info, message)
end
diff --git a/spec/unit/log_spec.rb b/spec/unit/log_spec.rb
index 756e5b43e0..931d0adf11 100644
--- a/spec/unit/log_spec.rb
+++ b/spec/unit/log_spec.rb
@@ -27,12 +27,12 @@ describe Chef::Log::Syslog do
let(:logger) { Chef::Log::Syslog.new }
it "should send message with severity info to syslog." do
- expect_any_instance_of(Logger::Syslog).to receive(:info).with(" *** Chef 12.4.0.dev.0 ***")
+ expect_any_instance_of(Logger::Syslog).to receive(:info).with("*** Chef 12.4.0.dev.0 ***")
logger.write("[2015-04-23T15:16:23+09:00] INFO: *** Chef 12.4.0.dev.0 ***")
end
it "should send message with severity warning to 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.")
+ 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