Sha256: bb320aaef7ec75a42007e0cf3c25b35c15df380e420cf87cf568376cc0f6f7c1
Contents?: true
Size: 948 Bytes
Versions: 3
Compression:
Stored size: 948 Bytes
Contents
# frozen_string_literal: true require "logger" require "rainbow" module GitHubChangelogGenerator module Helper # @return true if the currently running program is a unit test def self.test? defined? SpecHelper end # :nocov: @log ||= if test? Logger.new(nil) # don't show any logs when running tests else Logger.new($stdout) end @log.formatter = proc do |severity, _datetime, _progname, msg| string = "#{msg}\n" case severity when "DEBUG" then Rainbow(string).magenta when "INFO" then Rainbow(string).white when "WARN" then Rainbow(string).yellow when "ERROR" then Rainbow(string).red when "FATAL" then Rainbow(string).red.bright else string end end # :nocov: # Logging happens using this method class << self attr_reader :log end end end
Version data entries
3 entries across 3 versions & 1 rubygems