Class: Rex::Logging::Sinks::TimestampFlatfile

Inherits:
Flatfile
  • Object
show all
Defined in:
lib/rex/logging/sinks/timestamp_flatfile.rb

Overview

This class implements the LogSink interface and backs it against a file on disk with a Timestamp.

Instance Method Summary collapse

Methods inherited from Flatfile

#cleanup, #initialize

Methods included from LogSink

#cleanup

Constructor Details

This class inherits a constructor from Rex::Logging::Sinks::Flatfile

Instance Method Details

#log(sev, src, level, msg, from) ⇒ Object

:nodoc:



14
15
16
17
18
# File 'lib/rex/logging/sinks/timestamp_flatfile.rb', line 14

def log(sev, src, level, msg, from) # :nodoc:
  msg = msg.chop.gsub(/\x1b\[[0-9;]*[mG]/,'').gsub(/[\x01-\x02]/, " ")
  fd.write("[#{get_current_timestamp}] #{msg}\n")
  fd.flush
end