summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaire McQuin <claire@getchef.com>2015-07-07 09:58:35 -0700
committerClaire McQuin <claire@getchef.com>2015-07-21 09:46:21 -0700
commit8225589a536259273136d6cd6127b0e1cffd74cd (patch)
tree989724a6b5c1a1a402b476e0a333161c56e8df88
parent63c1218b4ca27e5f503b2f4527c363de451f0701 (diff)
downloadohai-8225589a536259273136d6cd6127b0e1cffd74cd.tar.gz
Make Ohai::Log usable by Ohai::Config.
-rw-r--r--lib/ohai/config.rb2
-rw-r--r--lib/ohai/log.rb13
-rw-r--r--lib/ohai/system.rb4
3 files changed, 11 insertions, 8 deletions
diff --git a/lib/ohai/config.rb b/lib/ohai/config.rb
index 38c714ec..4c51e08a 100644
--- a/lib/ohai/config.rb
+++ b/lib/ohai/config.rb
@@ -17,6 +17,7 @@
#
require 'mixlib/config'
+require 'ohai/log'
module Ohai
class Config
@@ -33,7 +34,6 @@ module Ohai
path
end
-
default :log_level, :info
default :log_location, STDERR
default :plugin_path, [ File.expand_path(File.join(File.dirname(__FILE__), 'plugins'))]
diff --git a/lib/ohai/log.rb b/lib/ohai/log.rb
index ac028daf..62a89e61 100644
--- a/lib/ohai/log.rb
+++ b/lib/ohai/log.rb
@@ -6,9 +6,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,15 +16,14 @@
# limitations under the License.
#
-require 'ohai/config'
require 'mixlib/log'
module Ohai
class Log
extend Mixlib::Log
-
- init(Ohai::Config[:log_location])
- level = Ohai::Config[:log_level]
-
+
+ init(STDERR)
+ level = :info
+
end
end
diff --git a/lib/ohai/system.rb b/lib/ohai/system.rb
index 87ca46d2..5df6c7f9 100644
--- a/lib/ohai/system.rb
+++ b/lib/ohai/system.rb
@@ -48,6 +48,10 @@ module Ohai
@v6_dependency_solver = Hash.new
+ # configure logging
+ Ohai::Log.init(Ohai::Config[:log_location])
+ Ohai::Log.level = Ohai::Config[:log_level]
+
@loader = Ohai::Loader.new(self)
@runner = Ohai::Runner.new(self, true)