From: Iain Barnett Date: 2011-03-29T04:16:29+09:00 Subject: Logger for class method from an included module Hi, I want to log what's happening when a class method is called, using a Logger instance. The code resembles this: module Helpers def self.included(klass) klass.extend ClassMethods end module ClassMethods def my_classy_method( arg1, arg2 ) #I want to log in here ... end end#ClassMethods end#Helpers class User include Helpers #boring stuff... end #called as such User.my_classy_method( "blah", "plop" ) I've no idea where I should send the logger instance to that I've already set up in the rest of the app. Would someone be good enough to enlighten me? Should I perhaps alter the method signature to send the logger in as an argument on the end like this: def my_classy_method( arg1, arg2, options={} ) options[:logger].debug ... User.my_classy_method( "blah", "plop", {logger: @logger} ) or would that be bad form? Any help on the matter is much appreciated. Regards, Iain