summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRyan Davis <ryand-ruby@zenspider.com>2019-06-05 19:46:59 -0700
committerRyan Davis <ryand-ruby@zenspider.com>2019-06-06 13:36:29 -0700
commitd0dc22161e5d6da10581855b9a61fa277f291801 (patch)
tree8e33eb4253590f4ea632cdd12f332cd5ed0a8411 /lib
parent9b2d51adfff3d6dda5e8fc0ca1d5c0eb40e7a393 (diff)
downloadmixlib-log-d0dc22161e5d6da10581855b9a61fa277f291801.tar.gz
Use $stdout instead of STDOUT for the default logdev.
This makes it testable using minitest/rspec IO assertions/expectations. STDOUT/STDERR should only be used to restore $stdout/$stderr if something goes haywire. The globals should be used for everyday use. Also bolstered an IO test to prevent the output from going to the rspec result output. Signed-off-by: Ryan Davis <zenspider@chef.io>
Diffstat (limited to 'lib')
-rw-r--r--lib/mixlib/log.rb2
-rw-r--r--lib/mixlib/log/logger.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/mixlib/log.rb b/lib/mixlib/log.rb
index 18cdfd3..599ac57 100644
--- a/lib/mixlib/log.rb
+++ b/lib/mixlib/log.rb
@@ -170,7 +170,7 @@ module Mixlib
def logger_for(*opts)
if opts.empty?
- Mixlib::Log::Logger.new(STDOUT)
+ Mixlib::Log::Logger.new($stdout)
elsif LEVELS.keys.inject(true) { |quacks, level| quacks && opts.first.respond_to?(level) }
opts.first
else
diff --git a/lib/mixlib/log/logger.rb b/lib/mixlib/log/logger.rb
index f92d4a2..f227f23 100644
--- a/lib/mixlib/log/logger.rb
+++ b/lib/mixlib/log/logger.rb
@@ -21,7 +21,7 @@ module Mixlib
#
# +logdev+::
# The log device. This is a filename (String) or IO object (typically
- # +STDOUT+, +STDERR+, or an open file).
+ # +$stdout+, +$stderr+, or an open file).
# +shift_age+::
# Number of old log files to keep, *or* frequency of rotation (+daily+,
# +weekly+ or +monthly+).