Class: Vagrant::Util::LoggingFormatter

Inherits:
Log4r::BasicFormatter
  • Object
show all
Defined in:
lib/vagrant/util/logging_formatter.rb

Overview

Wrapper for logging formatting to provide information scrubbing prior to being written to output target

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formatter) ⇒ LoggingFormatter

Creates a new formatter wrapper instance.

Parameters:

  • (Log4r::Formatter)


19
20
21
# File 'lib/vagrant/util/logging_formatter.rb', line 19

def initialize(formatter)
  @formatter = formatter
end

Instance Attribute Details

#formatterLog4r::PatternFormatter (readonly)

Returns:

  • (Log4r::PatternFormatter)


14
15
16
# File 'lib/vagrant/util/logging_formatter.rb', line 14

def formatter
  @formatter
end

Instance Method Details

#format(event) ⇒ Object

Format event and scrub output



24
25
26
27
# File 'lib/vagrant/util/logging_formatter.rb', line 24

def format(event)
  msg = formatter.format(event)
  CredentialScrubber.desensitize(msg)
end