le 2.1.3 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LE.gemspec +1 -1
- data/lib/le.rb +2 -2
- data/lib/le/host.rb +10 -19
- data/lib/le/host/http.rb +6 -2
- metadata +3 -3
data/LE.gemspec
CHANGED
data/lib/le.rb
CHANGED
@@ -4,13 +4,13 @@ require 'logger'
|
|
4
4
|
|
5
5
|
module Le
|
6
6
|
|
7
|
-
def self.new(token, local=false)
|
7
|
+
def self.new(token, local=false, debug_level = Logger::DEBUG)
|
8
8
|
|
9
9
|
self.checkParams(token)
|
10
10
|
|
11
11
|
host = Le::Host.new(token, local)
|
12
12
|
logger = Logger.new(host)
|
13
|
-
logger.level =
|
13
|
+
logger.level = debug_level
|
14
14
|
|
15
15
|
if host.respond_to?(:formatter)
|
16
16
|
logger.formatter = host.formatter
|
data/lib/le/host.rb
CHANGED
@@ -2,33 +2,24 @@ module Le
|
|
2
2
|
module Host
|
3
3
|
|
4
4
|
def self.new(token, local)
|
5
|
-
|
6
5
|
Le::Host::HTTP.new(token, local)
|
7
|
-
|
8
6
|
end
|
9
|
-
|
7
|
+
|
10
8
|
module InstanceMethods
|
11
9
|
def formatter
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
10
|
+
proc do |severity, datetime, _, msg|
|
11
|
+
message = "#{datetime} "
|
12
|
+
message << format_message(msg, severity)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
18
16
|
def format_message(message_in, severity)
|
19
|
-
|
17
|
+
message_in = message_in.inspect unless message_in.is_a?(String)
|
20
18
|
|
21
|
-
|
22
|
-
message_out = "severity=#{severity}, "
|
23
|
-
case message_in
|
24
|
-
when String
|
25
|
-
message_out << message_in
|
26
|
-
else
|
27
|
-
message_out << message_in.inspect
|
28
|
-
end
|
29
|
-
message_out
|
19
|
+
"severity=#{severity}, #{message_in.lstrip}"
|
30
20
|
end
|
31
21
|
end
|
22
|
+
|
32
23
|
end
|
33
24
|
end
|
34
25
|
|
data/lib/le/host/http.rb
CHANGED
@@ -10,6 +10,11 @@ module Le
|
|
10
10
|
attr_accessor :token, :queue, :started, :thread, :conn, :local
|
11
11
|
|
12
12
|
def initialize(token, local)
|
13
|
+
if defined?(Rails)
|
14
|
+
@logger_console = Logger.new("log/#{Rails.env}.log")
|
15
|
+
else
|
16
|
+
@logger_console = Logger.new(STDOUT);
|
17
|
+
end
|
13
18
|
@token = token
|
14
19
|
@local = local
|
15
20
|
@queue = Queue.new
|
@@ -19,8 +24,7 @@ module Le
|
|
19
24
|
|
20
25
|
def write(message)
|
21
26
|
if @local then
|
22
|
-
|
23
|
-
return
|
27
|
+
@logger_console.add(Logger::Severity::UNKNOWN,message)
|
24
28
|
end
|
25
29
|
|
26
30
|
@queue << "#{@token}#{message}\n"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: le
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-28 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! '
|
15
15
|
|
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
45
|
rubyforge_project:
|
46
|
-
rubygems_version: 1.8.
|
46
|
+
rubygems_version: 1.8.23
|
47
47
|
signing_key:
|
48
48
|
specification_version: 3
|
49
49
|
summary: Logentries plugin
|