Blankman
Blankman

Reputation: 267200

How to use the rails logger for classes/modules in the lib directory

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

Answers (1)

archana
archana

Reputation: 1272

You can directly use Rails.logger.info or Rails.logger.error anywhere you want in that class.

Upvotes: 3

Related Questions