Sha256: fac8fcec2bb490d2f4eb5136a7cd4e272f48dc33c6b8558d28476bec1a4ab6bc
Contents?: true
Size: 928 Bytes
Versions: 5
Compression:
Stored size: 928 Bytes
Contents
# frozen_string_literal: true require "track_ballast/error" module TrackBallast # Raised when logging is attempted without a configured logger class NoLoggerError < Error; end class << self # @!visibility private attr_writer :logger # Internal logger for +TrackBallast+. # # This defaults to +Rails.logger+. This +logger+ method may be removed in # the future if we determine that +Rails.logger+ is more sensible given the # focus of the library. Please do not use +TrackBallast.logger+ outside of # this gem. # # @!visibility private # @return [ActiveSupport::TaggedLogging] a tagged logger def logger if @logger @logger elsif defined?(Rails) # This will short-circuit to be `@logger` on future runs @logger = Rails.logger else raise NoLoggerError, "TrackBallast.logger is not configured" end end end end
Version data entries
5 entries across 5 versions & 1 rubygems