Module: OsCtl::Lib::Utils::Log::PrivateMethods

Defined in:
lib/libosctl/utils/log.rb

Constant Summary collapse

LEVELS =
%i[debug info warn error fatal unknown].freeze

Class Method Summary collapse

Class Method Details

.log(level, type, msg) ⇒ Object



6
7
8
9
10
11
# File 'lib/libosctl/utils/log.rb', line 6

def self.log(level, type, msg)
  Logger.log(
    LEVELS.include?(level) ? level : :unknown,
    "[#{type}] #{msg}"
  )
end

.resolve_type(type) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/libosctl/utils/log.rb', line 13

def self.resolve_type(type)
  return 'general' unless type

  if type.respond_to?(:log_type)
    type.log_type

  else
    type.to_s
  end
end