Module: TopologicalInventory::Providers::Common::LoggingFunctions

Defined in:
lib/topological_inventory/providers/common/logging.rb

Instance Method Summary collapse

Instance Method Details

#availability_check(message, severity = :info) ⇒ Object



25
26
27
# File 'lib/topological_inventory/providers/common/logging.rb', line 25

def availability_check(message, severity = :info)
  log_with_prefix("Source#availability_check", message, severity)
end

#collecting(status, source, entity_type, refresh_state_uuid, total_parts = nil) ⇒ Object



7
8
9
10
11
12
# File 'lib/topological_inventory/providers/common/logging.rb', line 7

def collecting(status, source, entity_type, refresh_state_uuid, total_parts = nil)
  msg = "[#{status.to_s.upcase}] Collecting #{entity_type}"
  msg += ", :total parts => #{total_parts}" if total_parts.present?
  msg += ", :source_uid => #{source}, :refresh_state_uuid => #{refresh_state_uuid}"
  info(msg)
end

#collecting_error(source, entity_type, refresh_state_uuid, exception) ⇒ Object



14
15
16
17
18
# File 'lib/topological_inventory/providers/common/logging.rb', line 14

def collecting_error(source, entity_type, refresh_state_uuid, exception)
  msg = "[ERROR] Collecting #{entity_type}, :source_uid => #{source}, :refresh_state_uuid => #{refresh_state_uuid}"
  msg += ":message => #{exception.message}\n#{exception.backtrace.join("\n")}"
  error(msg)
end

#log_with_prefix(prefix, message, severity) ⇒ Object



29
30
31
# File 'lib/topological_inventory/providers/common/logging.rb', line 29

def log_with_prefix(prefix, message, severity)
  send(severity, "#{prefix} - #{message}") if respond_to?(severity)
end

#sweeping(status, source, sweep_scope, refresh_state_uuid) ⇒ Object



20
21
22
23
# File 'lib/topological_inventory/providers/common/logging.rb', line 20

def sweeping(status, source, sweep_scope, refresh_state_uuid)
  msg = "[#{status.to_s.upcase}] Sweeping inactive records, :sweep_scope => #{sweep_scope}, :source_uid => #{source}, :refresh_state_uuid => #{refresh_state_uuid}"
  info(msg)
end