Sha256: ab66d56e429d5119fcb29bccf4453fe82ca449040d914f7558d738e2aae5b7f7
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
require 'logger' module Omnitest module Core module Logger def logger @logger ||= new_logger end def new_logger(io = $stdout, level = :debug) stdout_logger(io).tap do | logger | logger.level = Util.to_logger_level(level) end end # Construct a new standard out logger. # # @param stdout [IO] the IO object that represents stdout (or similar) # @param color [Symbol] color to use when outputing messages # @return [StdoutLogger] a new logger # @api private def stdout_logger(stdout, color = nil) logger = Omnitest::Core::StdoutLogger.new(stdout) # if Omnitest.tty? if stdout.tty? && color logger.formatter = proc do |_severity, _datetime, _progname, msg| Core::Color.colorize("#{msg}", color).concat("\n") end else logger.formatter = proc do |_severity, _datetime, _progname, msg| msg.concat("\n") end end logger end def log_level=(level) logger.level = level end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
omnitest-core-0.0.3 | lib/omnitest/core/logger.rb |
omnitest-core-0.0.2 | lib/omnitest/core/logger.rb |
omnitest-core-0.0.1 | lib/omnitest/core/logger.rb |