Reputation: 267200
I have classes/modules in my /lib folder that look like:
class MyClass
def self.doSomething()
end
end
How can I use the Rails logger for this class?
I have another class that doesn't have static methods like:
class OtherClass
def initialize(param1, param2)
@param1 = param1
@param2 = param2
end
end
Upvotes: 0
Views: 737
Reputation: 1272
You can directly use Rails.logger.info
or Rails.logger.error
anywhere you want in that class.
Upvotes: 3