summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-08-12 14:52:53 +0100
committerThom May <thom@chef.io>2016-08-12 15:03:12 +0100
commit5481158a3514c7b92e9fd7793f09f6c9dc2e146a (patch)
tree2f9eb895cc2983ddff28fbe1b959b7cba366b3ce
parentb2489a23ac0320139db1ae86ddb0fa6d9c1b257a (diff)
downloadohai-tm/less_greedy_init.tar.gz
only configure logging if we musttm/less_greedy_init
Signed-off-by: Thom May <thom@may.lt>
-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