logdna 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/lib/logdna.rb +1 -1
- data/lib/logdna/client.rb +25 -23
- data/lib/logdna/version.rb +1 -1
- data/test.rb +3 -11
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4e7d9d38989aa4c8ec3103f0cab3e25542e014f
|
4
|
+
data.tar.gz: bf903b372df4d3efc13a369bb1b6249ce64ad615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2026c77d627b4f209790a959a3e3d326b2080fec8b88fb678151b889b4bb5424179a3fe2ecb34ab9d6c184047d29f24b5a69a2a2b17736b4b3dab8b70c1a0366
|
7
|
+
data.tar.gz: 4689947e4595e22109867df5235d11371190086d5cec3147fe9d23f6307e87b19a69815c1ee5a6d3beb9a338b59411c39af78ef0c238e428015dc18394c5d760
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.0
|
data/lib/logdna.rb
CHANGED
data/lib/logdna/client.rb
CHANGED
@@ -39,7 +39,7 @@ module Logdna
|
|
39
39
|
@actual_byte_limit = opts[:flushbyte] ||= Resources::FLUSH_BYTE_LIMIT
|
40
40
|
|
41
41
|
@url = "#{Resources::ENDPOINT}?hostname=#{@qs[:hostname]}#{@qs[:mac]}#{@qs[:ip]}"
|
42
|
-
|
42
|
+
@@semaphore = Mutex.new
|
43
43
|
begin
|
44
44
|
@uri = URI(@url)
|
45
45
|
rescue URI::ValidURIRequired => e
|
@@ -48,8 +48,8 @@ module Logdna
|
|
48
48
|
return
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
@@request = Net::HTTP::Post.new(@uri, 'Content-Type' => 'application/json')
|
52
|
+
@@request.basic_auth 'username', key
|
53
53
|
self[:value] = Resources::LOGGER_CREATED
|
54
54
|
end
|
55
55
|
end
|
@@ -74,7 +74,7 @@ module Logdna
|
|
74
74
|
rescue Encoding::UndefinedConversionError => e
|
75
75
|
raise e
|
76
76
|
end
|
77
|
-
unless
|
77
|
+
unless @@semaphore.locked?
|
78
78
|
@currentbytesize += msg.bytesize
|
79
79
|
@firstbuff.push({
|
80
80
|
:line => msg,
|
@@ -103,25 +103,27 @@ module Logdna
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def flush()
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
@task.
|
122
|
-
|
123
|
-
|
124
|
-
|
106
|
+
if defined? @@request
|
107
|
+
@@semaphore.synchronize {
|
108
|
+
real = {:e => 'ls', :ls => @firstbuff }.to_json
|
109
|
+
@@request.body = real
|
110
|
+
@response = Net::HTTP.start(@uri.hostname, @uri.port, :use_ssl => @uri.scheme == 'https') do |http|
|
111
|
+
http.request(@@request)
|
112
|
+
end
|
113
|
+
unless @firstbuff.empty?
|
114
|
+
puts "Result: #{@response.body}"
|
115
|
+
end
|
116
|
+
@currentbytesize = @secondbytesize
|
117
|
+
@secondbytesize = 0
|
118
|
+
@firstbuff = []
|
119
|
+
@firstbuff = @firstbuff + @secondbuff
|
120
|
+
@secondbuff = []
|
121
|
+
unless @task.nil?
|
122
|
+
@task.shutdown
|
123
|
+
@task.kill
|
124
|
+
end
|
125
|
+
}
|
126
|
+
end
|
125
127
|
end
|
126
128
|
|
127
129
|
def exitout()
|
data/lib/logdna/version.rb
CHANGED
data/test.rb
CHANGED
@@ -26,17 +26,9 @@ options4 = {
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
logger = Logdna::Ruby.new('
|
30
|
-
logger.log('
|
31
|
-
|
32
|
-
logger = Logdna::Ruby.new('your-ingestion-key', options2)
|
33
|
-
logger.log('2With metadata, staging env', {:meta => {:once => {:first => "nested1", :another => "nested2"}}, :level => "TRACE"})
|
34
|
-
|
35
|
-
logger = Logdna::Ruby.new('your-ingestion-key', options3)
|
36
|
-
logger.log('3No metadata, development env changed to production env', {:level => "TRACE", :env => "PRODUCTION"})
|
37
|
-
|
38
|
-
logger = Logdna::Ruby.new('your-ingestion-key', options4)
|
39
|
-
logger.log('4No metadata, no env')
|
29
|
+
logger = Logdna::Ruby.new('Your Ingestion Key', options);
|
30
|
+
logger.log('YOYO');
|
31
|
+
logger.log('EQWEJQWIOE');
|
40
32
|
|
41
33
|
|
42
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logdna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gun Woo Choi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -102,6 +102,7 @@ extra_rdoc_files: []
|
|
102
102
|
files:
|
103
103
|
- ".gitignore"
|
104
104
|
- ".rspec"
|
105
|
+
- ".ruby-version"
|
105
106
|
- Gemfile
|
106
107
|
- LICENSE.txt
|
107
108
|
- README.md
|