Class: Dexter::LogSource

Inherits:
Object
  • Object
show all
Defined in:
lib/dexter/sources/log_source.rb

Instance Method Summary collapse

Constructor Details

#initialize(logfile, input_format) ⇒ LogSource

Returns a new instance of LogSource.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dexter/sources/log_source.rb', line 3

def initialize(logfile, input_format)
  @log_parser =
    case input_format
    when "csv"
      CsvLogParser.new(logfile)
    when "json"
      JsonLogParser.new(logfile)
    when "sql"
      SqlLogParser.new(logfile)
    else
      StderrLogParser.new(logfile)
    end
  @stdin = logfile == STDIN
end

Instance Method Details

#perform(collector) ⇒ Object



18
19
20
# File 'lib/dexter/sources/log_source.rb', line 18

def perform(collector)
  @log_parser.perform(collector)
end

#stdin?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/dexter/sources/log_source.rb', line 22

def stdin?
  @stdin
end