Class: LMC::Logger

Inherits:
Logger
  • Object
show all
Defined in:
lib/lmc/logger.rb

Overview

Custom logger that hides the cloud password in restclient output

Constant Summary collapse

@@header_token_re =
/"Authorization"=>"Bearer ([\S]*)"/

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cloudObject

Returns the value of attribute cloud.



7
8
9
# File 'lib/lmc/logger.rb', line 7

def cloud
  @cloud
end

Instance Method Details

#<<(line) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/lmc/logger.rb', line 9

def <<(line)
  value_found = @@header_token_re.match line
  if value_found
    line.gsub! value_found[1], 'TOKEN REDACTED'
  end
  line.gsub! @cloud.password, '********'
  super
end