Module: GitSprintLogger

Included in:
GitSprint::CLI
Defined in:
lib/git-sprint/logger.rb

Instance Method Summary collapse

Instance Method Details

#logObject

Access a logger, to stdout (for now).

Uses logging level ENV, which can be WARN, INFO, etc, or even a number (since those just map to integers anyway).



25
26
27
28
29
30
31
32
33
34
# File 'lib/git-sprint/logger.rb', line 25

def log
  Logger.new($stdout).tap do |logger|
    if Logger.constants.map(&:to_s).include? ENV['GIT_SPRINT_LOG_LEVEL']
      logger.level = Logger.const_get ENV['GIT_SPRINT_LOG_LEVEL']
    else
      logger.level = Logger::INFO
      logger.level = 9001 if GitSprint.testing?
    end
  end
end