Class: Logsly::Outputs::BaseData

Inherits:
Object
  • Object
show all
Defined in:
lib/logsly/outputs.rb

Direct Known Subclasses

FileData, SyslogData

Instance Method Summary collapse

Constructor Details

#initialize(*args, &build) ⇒ BaseData

Returns a new instance of BaseData.



42
43
44
45
46
47
48
# File 'lib/logsly/outputs.rb', line 42

def initialize(*args, &build)
  @pattern = '%m\n'
  @colors  = nil

  @args = args
  self.instance_exec(*@args, &(build || Proc.new{}))
end

Instance Method Details

#colors(value = nil) ⇒ Object



55
56
57
58
# File 'lib/logsly/outputs.rb', line 55

def colors(value = nil)
  @colors = value if !value.nil?
  @colors
end

#pattern(value = nil) ⇒ Object



50
51
52
53
# File 'lib/logsly/outputs.rb', line 50

def pattern(value = nil)
  @pattern = value if !value.nil?
  @pattern
end

#to_pattern_optsObject



60
61
62
63
64
65
66
67
68
# File 'lib/logsly/outputs.rb', line 60

def to_pattern_opts
  Hash.new.tap do |opts|
    opts[:pattern] = self.pattern if self.pattern

    if scheme_name = colors_obj.to_scheme(*@args)
      opts[:color_scheme] = scheme_name
    end
  end
end