Closed mjquinlan2000 closed 6 years ago
Ok so I was able to patch the Urbanairship::Loggable
module with a Rails initializer ($ROOT/config/initializers/urbanairship.rb):
Urbanairship::Loggable.class_eval do
def create_logger
logger = Logger.new(File.join(Rails.root, 'log', 'urbanairship.log'))
logger.datetime_format = '%Y-%m-%d %H:%M:%S'
logger.progname = 'Urbanairship'
logger
end
end
It just overrides the create_logger
method. I can still create a pull request if there's enough interest to make this configurable.
I think having a setter would be beneficial. I'd like to set it to Rails.logger (ideally not by overriding).
I would like an option to disable logging completely
@mjquinlan2000 Need to use instance_eval
instead of class_eval
now.
Thanks! We'll take a look at this when we do our next release.
This is fixed with #106
I've noticed that the gem outputs logs to $ROOT/urbanairship.log and there is no configuration available to either change the Logger that is used or the location of the file. At the very least, I would like to output all logs to my $ROOT/logs/ directory. So my question is either 1) is there a way to do this already? or 2) Would this be something you would be open to changing through a pull request?
If it's a change that you think would be beneficial to the community, I'd be happy to code up a solution.
Thanks!