Class: DLogger::Output::Stdout

Inherits:
Base
  • Object
show all
Defined in:
lib/dlogger/outputs/stdout.rb

Overview

Outputs data to stdout.

Instance Method Summary collapse

Constructor Details

#initialize(dump_metadata = true) ⇒ Stdout

Returns a new instance of Stdout.

Parameters:

  • dump_metadata (Boolean) (defaults to: true)

    if true the output will include the metadata dumped with inspect



15
16
17
18
19
# File 'lib/dlogger/outputs/stdout.rb', line 15

def initialize( = true)
  # without this you may not be able to tail the logs
  $stdout.sync = true
  @dump_metadata = 
end

Instance Method Details

#dispatch(msg, metadata) ⇒ Object

See Also:

  • Logger::dispatch


24
25
26
27
28
29
30
# File 'lib/dlogger/outputs/stdout.rb', line 24

def dispatch(msg, )
  if @dump_metadata
    Kernel.puts("#{msg} : #{.inspect}")
  else
    Kernel.puts(msg)
  end
end