summaryrefslogtreecommitdiff
path: root/chef-config
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2018-03-23 13:05:13 +0000
committerTim Smith <tsmith@chef.io>2018-03-26 10:34:39 -0700
commit97c1dd6f1cac6d97e85d05039cad8b28596141ba (patch)
treed8a97c0f7016986a2cc264aa50ae345638ed026c /chef-config
parent1b81f35e023bcdc87e410c641545e849298de5c3 (diff)
downloadchef-97c1dd6f1cac6d97e85d05039cad8b28596141ba.tar.gz
mechanical conversion of most debug log statements to trace
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'chef-config')
-rw-r--r--chef-config/lib/chef-config/config.rb4
-rw-r--r--chef-config/lib/chef-config/logger.rb3
-rw-r--r--chef-config/lib/chef-config/path_helper.rb2
-rw-r--r--chef-config/spec/unit/config_spec.rb8
4 files changed, 10 insertions, 7 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index c467d88f80..ad4ef0574d 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -1060,9 +1060,9 @@ module ChefConfig
end
rescue
if ChefConfig.windows?
- ChefConfig.logger.debug "Defaulting to locale en_US.UTF-8 on Windows, until it matters that we do something else."
+ ChefConfig.logger.trace "Defaulting to locale en_US.UTF-8 on Windows, until it matters that we do something else."
else
- ChefConfig.logger.debug "No usable locale -a command found, assuming you have en_US.UTF-8 installed."
+ ChefConfig.logger.trace "No usable locale -a command found, assuming you have en_US.UTF-8 installed."
end
"en_US.UTF-8"
end
diff --git a/chef-config/lib/chef-config/logger.rb b/chef-config/lib/chef-config/logger.rb
index d239e85f43..69d7889f88 100644
--- a/chef-config/lib/chef-config/logger.rb
+++ b/chef-config/lib/chef-config/logger.rb
@@ -27,6 +27,9 @@ module ChefConfig
def add(_severity, _message = nil, _progname = nil)
end
+ def trace(_progname = nil, &block)
+ end
+
def debug(_progname = nil, &block)
end
diff --git a/chef-config/lib/chef-config/path_helper.rb b/chef-config/lib/chef-config/path_helper.rb
index c011c4f18a..6341ffe4e6 100644
--- a/chef-config/lib/chef-config/path_helper.rb
+++ b/chef-config/lib/chef-config/path_helper.rb
@@ -79,7 +79,7 @@ module ChefConfig
end
if windows_max_length_exceeded?(path)
- ChefConfig.logger.debug("Path '#{path}' is longer than #{WIN_MAX_PATH}, prefixing with'\\\\?\\'")
+ ChefConfig.logger.trace("Path '#{path}' is longer than #{WIN_MAX_PATH}, prefixing with'\\\\?\\'")
path.insert(0, "\\\\?\\")
end
end
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index 41b4382cf0..71ea158840 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -767,8 +767,8 @@ RSpec.describe ChefConfig::Config do
shared_examples_for "a suitable locale" do
it "returns an English UTF-8 locale" do
expect(ChefConfig.logger).to_not receive(:warn).with(/Please install an English UTF-8 locale for Chef to use/)
- expect(ChefConfig.logger).to_not receive(:debug).with(/Defaulting to locale en_US.UTF-8 on Windows/)
- expect(ChefConfig.logger).to_not receive(:debug).with(/No usable locale -a command found/)
+ expect(ChefConfig.logger).to_not receive(:trace).with(/Defaulting to locale en_US.UTF-8 on Windows/)
+ expect(ChefConfig.logger).to_not receive(:trace).with(/No usable locale -a command found/)
expect(ChefConfig::Config.guess_internal_locale).to eq expected_locale
end
end
@@ -837,9 +837,9 @@ RSpec.describe ChefConfig::Config do
it "should default to 'en_US.UTF-8'" do
if is_windows
- expect(ChefConfig.logger).to receive(:debug).with("Defaulting to locale en_US.UTF-8 on Windows, until it matters that we do something else.")
+ expect(ChefConfig.logger).to receive(:trace).with("Defaulting to locale en_US.UTF-8 on Windows, until it matters that we do something else.")
else
- expect(ChefConfig.logger).to receive(:debug).with("No usable locale -a command found, assuming you have en_US.UTF-8 installed.")
+ expect(ChefConfig.logger).to receive(:trace).with("No usable locale -a command found, assuming you have en_US.UTF-8 installed.")
end
expect(ChefConfig::Config.guess_internal_locale).to eq "en_US.UTF-8"
end