le 1.8 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
data/LE.gemspec CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.join(dir, 'lib', 'le'))
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "le"
6
- s.version = "1.8"
6
+ s.version = "1.8.1"
7
7
  s.date = Time.now
8
8
  s.summary = "Logentries plugin"
9
9
  s.description =<<EOD
data/lib/le.rb CHANGED
@@ -15,8 +15,9 @@ module Le
15
15
 
16
16
  def self.new(key, location, local=false)
17
17
 
18
+ self.checkParams(key, location)
19
+
18
20
  host = Le::Host.new(key, location, local)
19
-
20
21
  logger = Logger.new(host)
21
22
 
22
23
  logger.formatter = host.formatter
@@ -24,4 +25,14 @@ module Le
24
25
  logger
25
26
  end
26
27
 
28
+ def self.checkParams(key, location)
29
+ if key == nil or location == nil
30
+ puts "\nLE: Incorrect parameters for Logentries Plugin!\n"
31
+ end
32
+
33
+ # Check if the key is valid UUID format
34
+ if (key =~ /\A(urn:uuid:)?[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i) == nil
35
+ puts "\nLE: It appears the LOGENTRIES_ACCOUNT_KEY you entered is invalid!\n"
36
+ end
37
+ end
27
38
  end
data/lib/le/host/https.rb CHANGED
@@ -9,7 +9,6 @@
9
9
 
10
10
  require 'socket'
11
11
  require 'openssl'
12
- require 'logger'
13
12
 
14
13
  require File.join(File.dirname(__FILE__), 'https', 'tcp')
15
14
 
@@ -21,20 +20,20 @@ module Le
21
20
  attr_reader :deliverer, :local_bool
22
21
 
23
22
  def initialize(key, location, local)
24
- @local_bool = local
25
- if not @local_bool
26
- @deliverer = Le::Host::HTTPS::TCPSOCKET.new(key, location)
27
- end
23
+ @local_bool = local
24
+ if not local
25
+ @deliverer = Le::Host::HTTPS::TCPSOCKET.new(key, location)
26
+ end
28
27
  end
29
28
 
30
29
  def write(message)
31
-
32
- if @local_bool
30
+
31
+ if @local_bool
33
32
  puts message
34
- else
35
- # Deliver the message to logentries via TCP if not testing locally
36
- @deliverer.deliver(message)
37
- end
33
+ else
34
+ # Deliver the message to logentries via TCP
35
+ @deliverer.deliver(message)
36
+ end
38
37
  end
39
38
 
40
39
  def close
@@ -58,8 +58,7 @@ module Le
58
58
  begin
59
59
  @conn.print(message + "\r\n")
60
60
  rescue OpenSSL::SSL::SSLError, TimeoutError, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ENOTCONN, Errno::ECONNRESET, Errno::ETIMEDOUT, EOFError => e
61
-
62
- $stderr.puts "WARNING: #{e.class} sending log #{e.message}"
61
+ $stderr.puts "WARNING: #{e.class} sending log #{e.message}"
63
62
  begin
64
63
  createSocket(@key, @location)
65
64
  rescue OpenSSL::SSL::SSLError, TimeoutError, Errno::EHOSTUNREACH, Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT, EOFError => e
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: le
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- version: "1.8"
9
+ - 1
10
+ version: 1.8.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Mark Lacomber (Logentries)
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2012-07-12 00:00:00 Z
18
+ date: 2012-07-17 00:00:00 Z
18
19
  dependencies: []
19
20
 
20
21
  description: |