summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2016-08-12 09:42:26 -0700
committerGitHub <noreply@github.com>2016-08-12 09:42:26 -0700
commita9658a8da7c45d098116cc0888bfda33fbfbd2a3 (patch)
tree2f9eb895cc2983ddff28fbe1b959b7cba366b3ce
parentb2489a23ac0320139db1ae86ddb0fa6d9c1b257a (diff)
parent5481158a3514c7b92e9fd7793f09f6c9dc2e146a (diff)
downloadohai-a9658a8da7c45d098116cc0888bfda33fbfbd2a3.tar.gz
Merge pull request #863 from chef/tm/less_greedy_init
only configure logging if we must
-rw-r--r--lib/ohai/log.rb8
-rw-r--r--lib/ohai/system.rb2
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/ohai/log.rb b/lib/ohai/log.rb
index c63f7abe..284d4fb0 100644
--- a/lib/ohai/log.rb
+++ b/lib/ohai/log.rb
@@ -25,5 +25,13 @@ module Ohai
init(STDERR)
level = :info
+ def self.configured?
+ @configured
+ end
+
+ def self.use_log_devices(other)
+ @configured = true
+ super
+ end
end
end
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb
index cc332164..17642814 100644
--- a/lib/ohai/system.rb
+++ b/lib/ohai/system.rb
@@ -220,6 +220,8 @@ module Ohai
end
def configure_logging
+ return if Ohai::Log.configured?
+
Ohai::Log.init(Ohai.config[:log_location])
if Ohai.config[:log_level] == :auto