diff options
author | Thom May <thom@chef.io> | 2016-08-12 18:19:11 +0100 |
---|---|---|
committer | Thom May <thom@chef.io> | 2016-08-12 18:19:11 +0100 |
commit | 3f74501b75e8f0c7745ea5fe170ebc9f43e89e96 (patch) | |
tree | df340e77cab67734a8be543a6f182b97bd03909b /lib | |
parent | 44b302fa7f3e503d68eb4f458846f679900aab2f (diff) | |
download | mixlib-log-3f74501b75e8f0c7745ea5fe170ebc9f43e89e96.tar.gz |
Allow applications to query if they've got loggers
This is required to avoid the problems in #17
Signed-off-by: Thom May <thom@may.lt>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mixlib/log.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/mixlib/log.rb b/lib/mixlib/log.rb index 5ec1ba0..7152a90 100644 --- a/lib/mixlib/log.rb +++ b/lib/mixlib/log.rb @@ -66,6 +66,7 @@ module Mixlib "You gave: #{other.inspect}" raise ArgumentError, msg end + @configured = true end # Use Mixlib::Log.init when you want to set up the logger manually. Arguments to this method @@ -80,9 +81,15 @@ module Mixlib @logger = logger_for(*opts) @logger.formatter = Mixlib::Log::Formatter.new() if @logger.respond_to?(:formatter=) @logger.level = Logger::WARN + @configured = true @logger end + # Let the application query if logging objects have been set up + def configured? + @configured + end + # Sets the level for the Logger object by symbol. Valid arguments are: # # :debug |