ConsoleSourceConsoleLogger

class Logger

Definitions

def self.default_log_level(env = ENV)

Set the default log level based on $DEBUG and $VERBOSE. You can also specify CONSOLE_LEVEL=debug or CONSOLE_LEVEL=info in environment. https://mislav.net/2011/06/ruby-verbose-mode/ has more details about how it all fits together.

Implementation

def self.default_log_level(env = ENV)
	if level = env["CONSOLE_LEVEL"]
		LEVELS[level.to_sym] || level.to_i
	elsif $DEBUG
		DEBUG
	elsif $VERBOSE.nil?
		WARN
	else
		INFO
	end
end

def self.verbose?(env = ENV)

Controls verbose output using $VERBOSE.

Implementation

def self.verbose?(env = ENV)
	!$VERBOSE.nil? || env["CONSOLE_VERBOSE"]
end