Class: TrueandcoAnalytics::Logger

Inherits:
Logger
  • Object
show all
Includes:
Singleton
Defined in:
lib/trueandco_analytics/common/services/logger.rb

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



6
7
8
9
10
# File 'lib/trueandco_analytics/common/services/logger.rb', line 6

def initialize
  super(Rails.root.join("log/#{Config::Params.log}.log"))
  self.formatter = formatter
  self
end

Instance Method Details

#formatterObject



12
13
14
15
16
17
18
# File 'lib/trueandco_analytics/common/services/logger.rb', line 12

def formatter
  Proc.new { |severity, time, progname, msg|
    formatted_severity = sprintf("%-5s", severity.to_s)
    formatted_time = time.strftime("%Y-%m-%d %H:%M:%S")
    "[#{formatted_severity} #{formatted_time} #{$$}] #{msg.to_s.strip}\n"
  }
end