Method: Rex::Logging::Sinks::Flatfile#log

Defined in:
lib/rex/logging/sinks/flatfile.rb

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

:nodoc:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rex/logging/sinks/flatfile.rb', line 28

def log(sev, src, level, msg, from) # :nodoc:
  if (sev == LOG_RAW)
    fd.write(msg)
  else
    code = 'i'

    case sev
      when LOG_DEBUG
        code = 'd'
      when LOG_ERROR
        code = 'e'
      when LOG_INFO
        code = 'i'
      when LOG_WARN
        code = 'w'
    end
    fd.write("[#{get_current_timestamp}] [#{code}(#{level})] #{src}: #{msg}\n")
  end

  fd.flush
end