Rails: Log stuff to rails app logs from any ruby class -
I want to be able to log in to my Rails app logs from Ruby Class.
I was hoping to do a class with I'm brand new to Rail / Ruby, and I'm assuming it That is because How can I include the "Post-Text "Itemprop =" text "> If you want to create your own logger: logger.info "some stuff" in
my_app / app / myClass.rb , but it It is not defined when I use
logger in my controllers and elsewhere then it works
logger category
myClass.rb , but it is automatically included in all controllers, models, etc.
logger class in an arbitrary Ruby class, or else I can login to my Rail App from a Ruby Class?
class MyClass def initialize @app_logger = Logger.new (" # {Rails.root} / log /app.log ") End DEF Other Method @ app_logger.info (" Anything here ") End / <>
Comments
Post a Comment