Add the logsink

bug/bundler_fix
Meatballs 2015-06-19 21:56:39 +01:00
parent 64449d5035
commit 50cd15c52a
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# -*- coding: binary -*-
module Rex
module Logging
module Sinks
###
#
# This class implements the LogSink interface and backs it against a
# file on disk with a Timestamp.
#
###
class TimestampFlatfile < Flatfile
def log(sev, src, level, msg, from) # :nodoc:
cleaned = msg.gsub(/\x1b\[[0-9;]*[mG]/,'')
fd.write("[#{get_current_timestamp}] #{src}: #{cleaned}\n")
fd.flush
end
end
end end end