Is there a way to output something in a gem?

By : MM.
Source: Stackoverflow.com
Question!

It seems that print, puts, or logger.info doesn't work in an included gem. I was wondering if there was a workaround.

By : MM.


Answers

A note for future: RAILS_DEFAULT_LOGGER had been deprecated in Rails 3.x+.

Now you can use:

Rails.logger.debug


RAILS_DEFAULT_LOGGER is a global reference you can use in almost any context.

By : Julian H


This video can help you solving your question :)
By: admin