Module: Nesta::Plugin::ContentFocus

Defined in:
lib/nesta-plugin-contentfocus/client.rb,
lib/nesta-plugin-contentfocus/logger.rb,
lib/nesta-plugin-contentfocus/routes.rb,
lib/nesta-plugin-contentfocus/helpers.rb,
lib/nesta-plugin-contentfocus/version.rb

Defined Under Namespace

Modules: Helpers, Routes Classes: Client

Constant Summary collapse

VERSION =
"0.0.20"

Class Method Summary collapse

Class Method Details

.loggerObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/nesta-plugin-contentfocus/logger.rb', line 5

def self.logger
  return @logger if @logger
  @logger = Logger.new(STDOUT)
  @logger.level = Logger::WARN
  if level = ENV["CONTENTFOCUS_LOG_LEVEL"]
    levels = ["FATAL", "ERROR", "WARN", "INFO", "DEBUG"]
    if levels.include? level.upcase
      @logger.level = Logger.const_get(level.upcase.to_sym)
    else
      @logger.warn "Log level '#{level.upcase}' is unknown. Supported levels are: #{levels.join(", ")}."
    end
  end
  @logger
end