module Telemetry::Logger::ConsoleLogger::Defaults

Public Class Methods

activation() click to toggle source
# File lib/telemetry/logger/console_logger.rb, line 85
def self.activation
  activation = ENV['LOGGER']
  return activation if activation

  'on'
end
color() click to toggle source
# File lib/telemetry/logger/console_logger.rb, line 92
def self.color
  color = ENV['LOG_COLOR']

  # CONSOLE_COLOR is obsolete. It is here for backwards compatibility
  if color.nil?
    color = ENV['CONSOLE_COLOR']

    unless color.nil?
      puts '*** WARNING: The CONSOLE_COLOR environment variable is obsolete. Use LOG_COLOR instead. Support for CONSOLE_COLOR will be discontinued.'
    end
  end

  return color if color

  if device.tty?
    'on'
  else
    'off'
  end
end
device() click to toggle source
# File lib/telemetry/logger/console_logger.rb, line 71
def self.device
  setting = ENV['CONSOLE_DEVICE']
  device = nil
  if setting && !['stderr', 'stdout'].include?(setting)
    raise "The CONSOLE_DEVICE should be either 'stderr' (default) or 'stdout'"
  elsif setting
    device = setting == 'stderr' ? STDERR : STDOUT
  else
    device = STDERR
  end
  device.sync = true
  device
end
level() click to toggle source
# File lib/telemetry/logger/console_logger.rb, line 64
def self.level
  level = ENV['LOG_LEVEL']
  return level.to_sym if level

  :info
end