diaspora/lib/federation_logger.rb
Steven Hancock a8de3a5a3f Rails.root and File.join cleanup
- `Rails.root` is a `Pathname`, so let's use `Rails.root.join`
- Clean up most of the remaining `File.join`s
2012-06-11 03:13:20 -07:00

15 lines
No EOL
512 B
Ruby

#custom_logger.rb
class FederationLogger < Logger
def format_message(severity, timestamp, progname, msg)
"#{Rails.env}-#{timestamp}: #{msg}\n"
end
end
if Rails.env.match(/integration/)
puts "using federation logger"
logfile = File.open(Rails.root.join("log", "#{Rails.env}_federation.log"), 'a') #create log file
logfile.sync = true #automatically flushes data to file
FEDERATION_LOGGER = FederationLogger.new(logfile) #constant accessible anywhere
else
FEDERATION_LOGGER = Rails.logger
end