Module: Tailor::Logger::Mixin

Overview

Provides an .included hook to insert the name of the class for each log message in the class that includes the Mixin.

Class Method Summary collapse

Class Method Details

.included(_) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/tailor/logger.rb', line 23

def self.included(_)
  define_method :log do |*args|
    class_minus_main_name = self.class.to_s.sub(/^.*::/, '')
    args.first.insert(0, "<#{class_minus_main_name}> ")
    Tailor::Logger.log(*args)
  end
end