le 1.6 → 1.8

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.6"
6
+ s.version = "1.8"
7
7
  s.date = Time.now
8
8
  s.summary = "Logentries plugin"
9
9
  s.description =<<EOD
data/lib/le.rb CHANGED
@@ -13,9 +13,10 @@ require 'logger'
13
13
 
14
14
  module Le
15
15
 
16
- def self.new(key, location)
16
+ def self.new(key, location, local=false)
17
17
 
18
- host = Le::Host.new(key, location)
18
+ host = Le::Host.new(key, location, local)
19
+
19
20
  logger = Logger.new(host)
20
21
 
21
22
  logger.formatter = host.formatter
@@ -13,9 +13,9 @@ module Le
13
13
  # Creates a new Logentries host, based on a user-key and location of destination file on logentries,
14
14
  # both must be provided correctly for a connection to be made.
15
15
 
16
- def self.new(key, location)
16
+ def self.new(key, location, local)
17
17
 
18
- Le::Host::HTTPS.new(key, location)
18
+ Le::Host::HTTPS.new(key, location, local)
19
19
 
20
20
  end
21
21
 
@@ -9,6 +9,7 @@
9
9
 
10
10
  require 'socket'
11
11
  require 'openssl'
12
+ require 'logger'
12
13
 
13
14
  require File.join(File.dirname(__FILE__), 'https', 'tcp')
14
15
 
@@ -17,20 +18,23 @@ module Le
17
18
  class HTTPS
18
19
  include Le::Host::HelperMethods
19
20
 
20
- attr_reader :deliverer
21
+ attr_reader :deliverer, :local_bool
21
22
 
22
- def initialize(key, location)
23
-
24
- @deliverer = Le::Host::HTTPS::TCPSOCKET.new(key, location)
25
-
23
+ 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
26
28
  end
27
29
 
28
30
  def write(message)
29
31
 
30
- # In the Heroku environment, this puts command will write the message to standard Heroku logs also
31
- puts message
32
- # Deliver the message to logentries via TCP
33
- @deliverer.deliver(message)
32
+ if @local_bool
33
+ puts message
34
+ else
35
+ # Deliver the message to logentries via TCP if not testing locally
36
+ @deliverer.deliver(message)
37
+ end
34
38
  end
35
39
 
36
40
  def close
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: le
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
- - 6
9
- version: "1.6"
8
+ - 8
9
+ version: "1.8"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Lacomber (Logentries)
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-08-09 00:00:00 Z
17
+ date: 2012-07-12 00:00:00 Z
18
18
  dependencies: []
19
19
 
20
20
  description: |
@@ -29,10 +29,10 @@ extra_rdoc_files: []
29
29
 
30
30
  files:
31
31
  - LE.gemspec
32
- - ./lib/le.rb
33
32
  - ./lib/le/host.rb
34
- - ./lib/le/host/https.rb
35
33
  - ./lib/le/host/https/tcp.rb
34
+ - ./lib/le/host/https.rb
35
+ - ./lib/le.rb
36
36
  homepage:
37
37
  licenses: []
38
38
 
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  requirements: []
63
63
 
64
64
  rubyforge_project:
65
- rubygems_version: 1.8.3
65
+ rubygems_version: 1.8.15
66
66
  signing_key:
67
67
  specification_version: 3
68
68
  summary: Logentries plugin