Method: FileFormatter#format
- Defined in:
- lib/maestro/log4r/file_formatter.rb
#format(logevent) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/maestro/log4r/file_formatter.rb', line 10 def format(logevent) if Log4r::LNAMES[logevent.level].eql? "PROGRESS" # Formats the data as is with no newline, to allow progress bars to be logged. sprintf("%s", logevent.data.to_s) else if logevent.data.kind_of? String # remove ^M characters logevent.data.gsub!(/\r/, "") # Prevent two newlines in the log file logevent.data.chop! if logevent.data =~ /\n$/ end sprintf("[%s %s] %s\n", Log4r::LNAMES[logevent.level], Time.now.strftime("%m/%d/%Y %I:%M:%S %p"), format_object(logevent.data)) end end |