Class: Fluent::Test::DummyLogDevice

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/test/log.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDummyLogDevice

Returns a new instance of DummyLogDevice.



26
27
28
29
30
# File 'lib/fluent/test/log.rb', line 26

def initialize
  @logs = []
  @flush_logs = true
  @use_stderr = false
end

Instance Attribute Details

#flush_logsObject

Returns the value of attribute flush_logs.



24
25
26
# File 'lib/fluent/test/log.rb', line 24

def flush_logs
  @flush_logs
end

#logsObject (readonly)

Returns the value of attribute logs.



23
24
25
# File 'lib/fluent/test/log.rb', line 23

def logs
  @logs
end

Instance Method Details

#closeObject



55
56
57
# File 'lib/fluent/test/log.rb', line 55

def close
  true
end

#flushObject



51
52
53
# File 'lib/fluent/test/log.rb', line 51

def flush
  true
end

#puts(*args) ⇒ Object



40
41
42
# File 'lib/fluent/test/log.rb', line 40

def puts(*args)
  args.each{ |arg| write(arg + "\n") }
end

#resetObject



32
33
34
# File 'lib/fluent/test/log.rb', line 32

def reset
  @logs = [] if @flush_logs
end

#tty?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/fluent/test/log.rb', line 36

def tty?
  false
end

#write(message) ⇒ Object



44
45
46
47
48
49
# File 'lib/fluent/test/log.rb', line 44

def write(message)
  if @use_stderr
    STDERR.write message
  end
  @logs.push message
end