Module: FPM::Cookery::Log

Defined in:
lib/fpm/cookery/log.rb,
lib/fpm/cookery/log/color.rb,
lib/fpm/cookery/log/output/null.rb,
lib/fpm/cookery/log/output/console.rb,
lib/fpm/cookery/log/output/console_color.rb

Defined Under Namespace

Modules: Output Classes: Color

Class Method Summary collapse

Class Method Details

.<<(event) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fpm/cookery/log.rb', line 48

def <<(event)
  level = event.fetch(:level, :info).downcase.to_sym

  event.delete(:level)

  data = event.clone

  data.delete(:message)
  data.delete(:timestamp)

  send(level, "[FPM] #{event[:message]} #{data.to_json}")
end

.debug(message) ⇒ Object



24
25
26
# File 'lib/fpm/cookery/log.rb', line 24

def debug(message)
  @output.debug(message) if @debug
end

.enable_debug(value = true) ⇒ Object



16
17
18
# File 'lib/fpm/cookery/log.rb', line 16

def enable_debug(value = true)
  @debug = value
end

.error(message) ⇒ Object



36
37
38
# File 'lib/fpm/cookery/log.rb', line 36

def error(message)
  @output.error(message)
end

.fatal(message) ⇒ Object



40
41
42
# File 'lib/fpm/cookery/log.rb', line 40

def fatal(message)
  @output.fatal(message)
end

.info(message) ⇒ Object



28
29
30
# File 'lib/fpm/cookery/log.rb', line 28

def info(message)
  @output.info(message)
end

.output(out) ⇒ Object



20
21
22
# File 'lib/fpm/cookery/log.rb', line 20

def output(out)
  @output = out
end

.puts(message) ⇒ Object



44
45
46
# File 'lib/fpm/cookery/log.rb', line 44

def puts(message)
  @output.puts(message)
end

.warn(message) ⇒ Object



32
33
34
# File 'lib/fpm/cookery/log.rb', line 32

def warn(message)
  @output.warn(message)
end