Module: GClouder::Logging::Appenders

Defined in:
lib/gclouder/logging.rb

Class Method Summary collapse

Class Method Details

.fileObject



73
74
75
76
77
78
# File 'lib/gclouder/logging.rb', line 73

def self.file
  {
    appender: ::Logger.new(File.join(File.dirname(__FILE__), "../../log.txt")),
    format: proc { |severity, datetime, _, message| "#{severity} - #{datetime}: #{message}\n" }
  }
end

.stdoutObject



66
67
68
69
70
71
# File 'lib/gclouder/logging.rb', line 66

def self.stdout
  {
    appender: ::Logger.new(STDOUT),
    format: proc { |_, _, _, message| "#{message}\n" }
  }
end

.stringio(obj = StringIO.new) ⇒ Object



80
81
82
83
84
85
# File 'lib/gclouder/logging.rb', line 80

def self.stringio(obj = StringIO.new)
  {
    appender: ::Logger.new(StringIO.new),
    format: proc { |severity, datetime, _, message| "#{severity} - #{datetime}: #{message}\n" }
  }
end