logdna 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logdna.rb +17 -13
- data/lib/logdna/client.rb +39 -38
- data/lib/logdna/version.rb +1 -1
- data/test.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c55551804963d24df4eb0ea8582cce2043f0567d
|
4
|
+
data.tar.gz: 0e9aa46f633cfa23ebc9d9d13ce1203be38a6e59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acd3e19e004f4b09a800558f2b82ed310fffedd2281829b6a7342492ff0fa403ac3ad4a9219797e44734d2da297b99546e1182bc74bce495cd11f541c91bc8f2
|
7
|
+
data.tar.gz: d90c07c141bb8a0ad76fe035177349db15d7a332c9d91081731aee278db55e3ed1c6b3e284d717530595bb671801d48edae2656f44560b4982d20cb92952459b
|
data/lib/logdna.rb
CHANGED
@@ -22,7 +22,7 @@ module Logdna
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
def log(msg, opts={})
|
25
|
+
def log(msg=nil, opts={})
|
26
26
|
if @level || @app || @env
|
27
27
|
@@client.change(@level, @app, @env)
|
28
28
|
@level = nil
|
@@ -35,42 +35,42 @@ module Logdna
|
|
35
35
|
'Saved'
|
36
36
|
end
|
37
37
|
|
38
|
-
def trace(msg, opts={})
|
38
|
+
def trace(msg=nil, opts={})
|
39
39
|
opts[:level] = "TRACE"
|
40
40
|
loggerExist?
|
41
41
|
@response = @@client.tobuffer(msg, opts)
|
42
42
|
'Saved'
|
43
43
|
end
|
44
44
|
|
45
|
-
def debug(msg, opts={})
|
45
|
+
def debug(msg=nil, opts={})
|
46
46
|
opts[:level] = "DEBUG"
|
47
47
|
loggerExist?
|
48
48
|
@response = @@client.tobuffer(msg, opts)
|
49
49
|
'Saved'
|
50
50
|
end
|
51
51
|
|
52
|
-
def info(msg, opts={})
|
52
|
+
def info(msg=nil, opts={})
|
53
53
|
opts[:level] = "INFO"
|
54
54
|
loggerExist?
|
55
55
|
@response = @@client.tobuffer(msg, opts)
|
56
56
|
'Saved'
|
57
57
|
end
|
58
58
|
|
59
|
-
def warn(msg, opts={})
|
59
|
+
def warn(msg=nil, opts={})
|
60
60
|
opts[:level] = "WARN"
|
61
61
|
loggerExist?
|
62
62
|
@response = @@client.tobuffer(msg, opts)
|
63
63
|
'Saved'
|
64
64
|
end
|
65
65
|
|
66
|
-
def error(msg, opts={})
|
66
|
+
def error(msg=nil, opts={})
|
67
67
|
opts[:level] = "ERROR"
|
68
68
|
loggerExist?
|
69
69
|
@response = @@client.tobuffer(msg, opts)
|
70
70
|
'Saved'
|
71
71
|
end
|
72
72
|
|
73
|
-
def fatal(msg, opts={})
|
73
|
+
def fatal(msg=nil, opts={})
|
74
74
|
opts[:level] = "FATAL"
|
75
75
|
loggerExist?
|
76
76
|
@response = @@client.tobuffer(msg, opts)
|
@@ -139,9 +139,11 @@ module Logdna
|
|
139
139
|
return comparedTo == @level.upcase
|
140
140
|
end
|
141
141
|
|
142
|
-
def <<(
|
143
|
-
|
144
|
-
|
142
|
+
def <<(msg=nil, opts={})
|
143
|
+
opts[:level] = ""
|
144
|
+
loggerExist?
|
145
|
+
@response = @@client.tobuffer(msg, opts)
|
146
|
+
'Saved'
|
145
147
|
end
|
146
148
|
|
147
149
|
def add(*arg)
|
@@ -149,9 +151,11 @@ module Logdna
|
|
149
151
|
return false
|
150
152
|
end
|
151
153
|
|
152
|
-
def unknown(
|
153
|
-
|
154
|
-
|
154
|
+
def unknown(msg=nil, opts={})
|
155
|
+
opts[:level] = "UNKNOWN"
|
156
|
+
loggerExist?
|
157
|
+
@response = @@client.tobuffer(msg, opts)
|
158
|
+
'Saved'
|
155
159
|
end
|
156
160
|
|
157
161
|
def datetime_format(*arg)
|
data/lib/logdna/client.rb
CHANGED
@@ -74,51 +74,52 @@ module Logdna
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def tobuffer(msg, opts)
|
77
|
-
|
78
|
-
|
77
|
+
unless msg.nil?
|
78
|
+
if @task
|
79
|
+
unless @task.running?
|
80
|
+
@task = Concurrent::TimerTask.new(execution_interval: @actual_flush_interval, timeout_interval: Resources::TIMER_OUT){ flush() }
|
81
|
+
@task.execute
|
82
|
+
end
|
83
|
+
else
|
79
84
|
@task = Concurrent::TimerTask.new(execution_interval: @actual_flush_interval, timeout_interval: Resources::TIMER_OUT){ flush() }
|
80
85
|
@task.execute
|
81
86
|
end
|
82
|
-
else
|
83
|
-
@task = Concurrent::TimerTask.new(execution_interval: @actual_flush_interval, timeout_interval: Resources::TIMER_OUT){ flush() }
|
84
|
-
@task.execute
|
85
|
-
end
|
86
87
|
|
87
|
-
|
88
|
-
|
89
|
-
|
88
|
+
unless msg.instance_of? String
|
89
|
+
msg = msg.to_s
|
90
|
+
end
|
90
91
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
92
|
+
begin
|
93
|
+
msg = msg.encode("UTF-8")
|
94
|
+
rescue Encoding::UndefinedConversionError => e
|
95
|
+
raise e
|
96
|
+
end
|
97
|
+
unless @@semaphore.locked?
|
98
|
+
@currentbytesize += msg.bytesize
|
99
|
+
@firstbuff.push({
|
100
|
+
:line => msg,
|
101
|
+
:app => opts[:app] ||= @qs[:app],
|
102
|
+
:level => opts[:level] ||= @qs[:level],
|
103
|
+
:timestamp => Time.now.to_i,
|
104
|
+
:meta => opts[:meta] ||= nil,
|
105
|
+
:env => (opts[:env]) ? opts[:env] : (@qs[:env]) ? @qs[:env] : nil
|
106
|
+
}.reject { |k,v| k === :meta && v.nil? })
|
107
|
+
else
|
108
|
+
@secondbytesize += msg.bytesize
|
109
|
+
@secondbuff.push({
|
110
|
+
:line => msg,
|
111
|
+
:app => opts[:app] ||= @qs[:app],
|
112
|
+
:level => opts[:level] ||= @qs[:level],
|
113
|
+
:timestamp => Time.now.to_i,
|
114
|
+
:meta => opts[:meta] ||= nil,
|
115
|
+
:env => (opts[:env]) ? opts[:env] : (@qs[:env]) ? @qs[:env] : nil
|
116
|
+
}.reject { |k,v| k === :meta && v.nil? })
|
117
|
+
end
|
117
118
|
|
118
|
-
|
119
|
-
|
119
|
+
if @actual_byte_limit < @currentbytesize
|
120
|
+
flush()
|
121
|
+
end
|
120
122
|
end
|
121
|
-
|
122
123
|
end
|
123
124
|
|
124
125
|
def flush()
|
data/lib/logdna/version.rb
CHANGED
data/test.rb
CHANGED
@@ -2,10 +2,10 @@ require 'require_all'
|
|
2
2
|
require_all 'lib'
|
3
3
|
|
4
4
|
|
5
|
-
options = {hostname: "
|
5
|
+
options = {hostname: "new"}
|
6
6
|
|
7
7
|
|
8
|
-
logger1 = Logdna::Ruby.new('Your
|
8
|
+
logger1 = Logdna::Ruby.new('Your API Key', options)
|
9
9
|
|
10
10
|
logger1.level = Logger::TRACE
|
11
11
|
logger1.log('is this trace')
|
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.8
|
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-
|
11
|
+
date: 2017-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|