Class: AchClient::Logging

Inherits:
Object
  • Object
show all
Defined in:
lib/ach_client/logging/logging.rb,
lib/ach_client/logging/savon_observer.rb,
lib/ach_client/logging/log_provider_job.rb,
lib/ach_client/logging/log_providers/log_provider.rb,
lib/ach_client/logging/log_providers/null_log_provider.rb,
lib/ach_client/logging/log_providers/stdout_log_provider.rb

Overview

Base class for all things logging

Defined Under Namespace

Classes: LogProvider, LogProviderJob, NullLogProvider, SavonObserver, StdoutLogProvider

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.codecActiveSupport::MessageEncryptor

Creates a codec (does encryption and decryption) using the provided password and salt

Returns:

  • (ActiveSupport::MessageEncryptor)

    the encryptor



55
56
57
58
59
60
61
# File 'lib/ach_client/logging/logging.rb', line 55

def self.codec
  ActiveSupport::MessageEncryptor.new(
    ActiveSupport::KeyGenerator.new(
      AchClient::Logging.encryption_password
    ).generate_key(AchClient::Logging.encryption_salt, 32)
  )
end

.decrypt_log(gibberish) ⇒ Object

Decrypt encrypted log file

Parameters:

  • gibberish (String)

    the log body to decrypt



72
73
74
# File 'lib/ach_client/logging/logging.rb', line 72

def self.decrypt_log(gibberish)
  codec.decrypt_and_verify(gibberish)
end

.log_filtersArray<String>

Returns List of XML nodes to scrub.

Returns:

  • (Array<String>)

    List of XML nodes to scrub



42
43
44
# File 'lib/ach_client/logging/logging.rb', line 42

def self.log_filters
  self._log_filters || []
end

.log_filters=(filters) ⇒ Object

Updates the log filters

Parameters:

  • filters (Array<String>)

    List of XML nodes to scrub from the logs



48
49
50
# File 'lib/ach_client/logging/logging.rb', line 48

def self.log_filters=(filters)
  self._log_filters = filters
end

.log_providerClass

Defaults to AchClient::Logging::NullLogProvider

Returns:

  • (Class)

    The Log provider to use.



22
23
24
# File 'lib/ach_client/logging/logging.rb', line 22

def self.log_provider
  self._log_provider_type || AchClient::Logging::NullLogProvider
end

.log_provider=(log_provider) ⇒ Object

Set the log provider Must extend AchClient::Logging::LogProvider

Parameters:

  • the (Class)

    new log provider



29
30
31
32
33
34
35
36
# File 'lib/ach_client/logging/logging.rb', line 29

def self.log_provider=(log_provider)
  if log_provider.is_a?(Class) &&
     log_provider < AchClient::Logging::LogProvider
    self._log_provider_type = log_provider
  else
    raise 'Must be subclass of AchClient::Logging::LogProvider'
  end
end

.should_use_encryption?Boolean

Returns whether the client has enabled encryption - if both a username and salt have been provided

Returns:

  • (Boolean)

    is encryption enabled?



66
67
68
# File 'lib/ach_client/logging/logging.rb', line 66

def self.should_use_encryption?
  encryption_password && encryption_salt
end

Instance Method Details

#_log_filtersArray<String>

Returns List of XML nodes to scrub.

Returns:

  • (Array<String>)

    List of XML nodes to scrub



39
# File 'lib/ach_client/logging/logging.rb', line 39

class_attribute :_log_filters

#_log_provider_typeClass

Returns type of the log provider.

Returns:

  • (Class)

    type of the log provider



12
# File 'lib/ach_client/logging/logging.rb', line 12

class_attribute :_log_provider_type

#encryption_passwordString

Returns password to use for encrypting logs.

Returns:

  • (String)

    password to use for encrypting logs



15
# File 'lib/ach_client/logging/logging.rb', line 15

class_attribute :encryption_password

#encryption_saltString

Returns salt to use for encrypting logs.

Returns:

  • (String)

    salt to use for encrypting logs



18
# File 'lib/ach_client/logging/logging.rb', line 18

class_attribute :encryption_salt