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)

17
18
19
# File 'lib/vagrant/util/logging_formatter.rb', line 17

def initialize(formatter)
  @formatter = formatter
end

Instance Attribute Details

#formatterLog4r::PatternFormatter (readonly)

Returns:

  • (Log4r::PatternFormatter)

12
13
14
# File 'lib/vagrant/util/logging_formatter.rb', line 12

def formatter
  @formatter
end

Instance Method Details

#format(event) ⇒ Object

Format event and scrub output


22
23
24
25
# File 'lib/vagrant/util/logging_formatter.rb', line 22

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