class Logging::Appenders::StackifyRubyLogging

Public Class Methods

new(opts = {}) click to toggle source
Calls superclass method
# File lib/logging/appenders/stackify.rb, line 11
def initialize(opts = {})
  super(opts[:app_name], opts)
  logger = ::Logger.new(opts[:debug_log])
  version_190 = '1.9.0'
  version_200 = '2.0.0'
  if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new(version_190) ||
    Gem::Version.new(RUBY_VERSION) <= Gem::Version.new(version_200)
    error_msg = 'Error: stackify-ruby-logging gem is currently not compatible in ruby version 1.9.x/2.0.x'
    puts error_msg
    logger.error error_msg
  else
    # Setup the configuration for stackify-api-ruby
    if defined? Stackify
      Stackify.setup do |config|
        config.api_key = opts[:api_key]
        config.env = opts[:environment] || :development
        config.app_name = opts[:app_name] || 'default'
        config.log_level = opts[:log_level] || :debug
        config.mode = :logging
        config.logger = logger
      end
      Stackify.run
    end
  end
end