Module: SwarmClusterCliOpe::LoggerConcern

Included in:
BaseConfiguration, Cli, Commands::Base, K8s, Kubernetes::Pod, Models::Base, Node, ShellCommandExecution, ShellCommandResponse, SyncConfigs::Base
Defined in:
lib/swarm_cluster_cli_ope/logger_concern.rb

Instance Method Summary collapse

Instance Method Details

#loggerObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/swarm_cluster_cli_ope/logger_concern.rb', line 5

def logger
  return LoggerConcern.const_get("LOGGER") if LoggerConcern.const_defined?("LOGGER")
  logger = Logger.new(STDOUT)
  LoggerConcern.const_set("LOGGER", logger)
  logger.level = case BaseConfiguration.instance.logger_level
                 when "0"
                   Logger::ERROR
                 when "1"
                   Logger::WARN
                 when "2"
                   Logger::INFO
                 when "3"
                   Logger::DEBUG
                 else
                   Logger::ERROR
                 end

  logger
end