use stdlib logger for FEDERATION_LOGGER, closes #5657
This commit is contained in:
parent
2570d88cc3
commit
7060840d0f
1 changed files with 1 additions and 12 deletions
|
|
@ -1,11 +1,3 @@
|
||||||
#custom_logger.rb
|
|
||||||
|
|
||||||
class ActiveSupport::BufferedLogger
|
|
||||||
def formatter=(formatter)
|
|
||||||
@log.formatter = formatter
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Formatter
|
class Formatter
|
||||||
COLORS = {
|
COLORS = {
|
||||||
'FG' => {
|
'FG' => {
|
||||||
|
|
@ -104,14 +96,11 @@ class Formatter
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class FederationLogger < ActiveSupport::BufferedLogger
|
|
||||||
end
|
|
||||||
|
|
||||||
if Rails.env.match(/integration/)
|
if Rails.env.match(/integration/)
|
||||||
puts "using federation logger"
|
puts "using federation logger"
|
||||||
logfile = File.open(Rails.root.join("log", "federation_logger.log"), 'a') #create log file
|
logfile = File.open(Rails.root.join("log", "federation_logger.log"), 'a') #create log file
|
||||||
logfile.sync = true #automatically flushes data to file
|
logfile.sync = true #automatically flushes data to file
|
||||||
FEDERATION_LOGGER = FederationLogger.new(logfile) #constant accessible anywhere
|
FEDERATION_LOGGER = Logger.new(logfile) #constant accessible anywhere
|
||||||
FEDERATION_LOGGER.formatter = Formatter.new
|
FEDERATION_LOGGER.formatter = Formatter.new
|
||||||
else
|
else
|
||||||
FEDERATION_LOGGER = Rails.logger
|
FEDERATION_LOGGER = Rails.logger
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue