Class: Tumugi::Logger

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/tumugi/logger/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



15
16
17
18
19
20
21
# File 'lib/tumugi/logger/logger.rb', line 15

def initialize
  @formatters = {
    text: text_formatter,
    json: json_formatter
  }
  init
end

Instance Attribute Details

#workflow_idObject

Returns the value of attribute workflow_id.



13
14
15
# File 'lib/tumugi/logger/logger.rb', line 13

def workflow_id
  @workflow_id
end

Instance Method Details

#init(output: STDOUT, format: :text) ⇒ Object



23
24
25
26
27
# File 'lib/tumugi/logger/logger.rb', line 23

def init(output: STDOUT, format: :text)
  @logger = ::Logger.new(output)
  @logger.level = ::Logger::INFO
  @logger.formatter = @formatters[format]
end

#quiet!Object



33
34
35
# File 'lib/tumugi/logger/logger.rb', line 33

def quiet!
  @logger = ::Logger.new(nil)
end

#verbose!Object



29
30
31
# File 'lib/tumugi/logger/logger.rb', line 29

def verbose!
  @logger.level = ::Logger::DEBUG
end