Skip to content

Commit

Permalink
Merge pull request #863 from chef/tm/less_greedy_init
Browse files Browse the repository at this point in the history
only configure logging if we must
  • Loading branch information
tas50 authored Aug 12, 2016
2 parents b2489a2 + 5481158 commit a9658a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ohai/log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,13 @@ class Log
init(STDERR)
level = :info

def self.configured?
@configured
end

def self.use_log_devices(other)
@configured = true
super
end
end
end
2 changes: 2 additions & 0 deletions lib/ohai/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ def configure_ohai
end

def configure_logging
return if Ohai::Log.configured?

Ohai::Log.init(Ohai.config[:log_location])

if Ohai.config[:log_level] == :auto
Expand Down

0 comments on commit a9658a8

Please sign in to comment.