Sha256: 7702c04414988b3644c494c50f057d5b022912eda9c642dddddcf5be3c53736f

Contents?: true

Size: 756 Bytes

Versions: 3

Compression:

Stored size: 756 Bytes

Contents

require File.join(File.dirname(__FILE__), 'le', 'host')

require 'logger'

module Le

 def self.new(token, options={})

   self.checkParams(token)

   opt_local = options[:local] || false
   opt_debug = options[:debug] || false
   opt_log_level = options[:log_level] || Logger::DEBUG

   host = Le::Host.new(token, opt_local, opt_debug)      
   logger = Logger.new(host)

   logger.level = opt_log_level
   
   if host.respond_to?(:formatter)
	logger.formatter = host.formatter
   end

   logger  
 end

 def self.checkParams(token)
    # Check if the key is valid UUID format
    if (token =~ /\A(urn:uuid:)?[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i) == nil
       puts "\nLE: It appears the LOGENTRIES_TOKEN you entered is invalid!\n"
    end
 end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
le-2.1.9 ./lib/le.rb
le-2.1.8 ./lib/le.rb
le-2.1.7 ./lib/le.rb