Module: FaaStRuby::Local::Logger

Included in:
FaaStRuby::Local, CrystalFunction, Function, Function, Listener, ListenerEvent, Processor, RubyFunction, StaticFile
Defined in:
lib/faastruby/local/logger.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.puts(msg) ⇒ Object



5
6
7
8
9
10
# File 'lib/faastruby/local/logger.rb', line 5

def self.puts(msg)
  STDOUT_MUTEX.synchronize do
    STDOUT.puts "#{Time.now} | #{msg}".yellow
    STDOUT.puts "---".yellow
  end
end

Instance Method Details

#debug(msg) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/faastruby/local/logger.rb', line 12

def debug(msg)
  return false unless DEBUG
  name = self.name if ['Module', 'Class'].include? self.class.name
  name ||= self.class.name
  STDOUT_MUTEX.synchronize do
    STDOUT.puts "#{Time.now} | [DEBUG] [#{name}] #{msg}".red
    STDOUT.puts "---".red
  end
end

#puts(msg) ⇒ Object



22
23
24
25
26
27
# File 'lib/faastruby/local/logger.rb', line 22

def puts(msg)
  STDOUT_MUTEX.synchronize do
    STDOUT.puts "#{Time.now} | #{msg}".yellow
    STDOUT.puts "---".yellow
  end
end