Sha256: 56534fb52b1b6215b8bc8c6c99e4e175408d47aafa9acad33423202360ea44c0
Contents?: true
Size: 788 Bytes
Versions: 8
Compression:
Stored size: 788 Bytes
Contents
# frozen_string_literal: true require 'active_support' module HermesMessengerOfTheGods module LoggingHelpers extend ActiveSupport::Concern included do Logger::Severity.constants.each do |sev| define_method("say_#{sev.downcase}") do |msg = nil, &blk| say("Logger::#{sev}".constantize, msg, &blk) end end def say(level, msg = nil, &blk) return if HermesMessengerOfTheGods.config.quiet [*HermesMessengerOfTheGods.config.logger].compact.each do |logger| logger.progname = logger.progname.tap do |_| logger.progname = log_message_prefix logger.log(level, msg, &blk) end end end def log_message_prefix self.class.to_s end end end end
Version data entries
8 entries across 8 versions & 1 rubygems