diff options
author | Tim Smith <tsmith@chef.io> | 2016-08-12 09:42:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-12 09:42:26 -0700 |
commit | a9658a8da7c45d098116cc0888bfda33fbfbd2a3 (patch) | |
tree | 2f9eb895cc2983ddff28fbe1b959b7cba366b3ce | |
parent | b2489a23ac0320139db1ae86ddb0fa6d9c1b257a (diff) | |
parent | 5481158a3514c7b92e9fd7793f09f6c9dc2e146a (diff) | |
download | ohai-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.rb | 8 | ||||
-rw-r--r-- | lib/ohai/system.rb | 2 |
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 |