Module: DVLA::Herodotus

Defined in:
lib/dvla/herodotus.rb,
lib/dvla/herodotus/version.rb,
lib/dvla/herodotus/multi_writer.rb,
lib/dvla/herodotus/herodotus_logger.rb

Defined Under Namespace

Classes: HerodotusLogger, MultiWriter

Constant Summary collapse

CONFIG_ATTRIBUTES =
i(system_name pid merge).freeze
VERSION =
'1.1.0'.freeze

Class Method Summary collapse

Class Method Details

.configObject



16
17
18
# File 'lib/dvla/herodotus.rb', line 16

def self.config
  @config || configure
end

.configure {|@config| ... } ⇒ Object

Yields:



10
11
12
13
14
# File 'lib/dvla/herodotus.rb', line 10

def self.configure
  @config ||= Struct.new(*CONFIG_ATTRIBUTES).new
  yield(@config) if block_given?
  @config
end

.logger(output_path: nil) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/dvla/herodotus.rb', line 20

def self.logger(output_path: nil)
  logger = create_logger(output_path)
  logger.system_name = "#{config.system_name} " unless config.system_name.nil?
  logger.requires_pid = config.pid
  logger.merge = config.merge
  logger.register_default_correlation_id
  logger.merge_correlation_ids if config.merge
  logger
end