logdna 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/lib/logdna.rb +4 -2
- data/lib/logdna/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b6d490f2946fb1865ea42c2173c67bb1334cd86
|
4
|
+
data.tar.gz: fa0172a11376438db312bf4f292d22e39a6f2d6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01f9b8b658b15efd35361ab6d6a92ce7f20ce761a5945f646d12430888bd60c37a9330e83f8dde8e3d2e5ab5d7ab3f4c512fe0e122b5492d5f1eb9b14cfed14d
|
7
|
+
data.tar.gz: 175a0d1a5efad591e3b3707e47185d47c0a0af5f19bfbbb5739aecf44445cf93e81170c106d972a14b6e0eb3ec733cb9039d70a9b1ce0df26d9d65309b9cbc20
|
data/README.md
CHANGED
@@ -50,7 +50,8 @@ Options are optional variables that may contain hostname, app name, mac address,
|
|
50
50
|
:app => myAppName,
|
51
51
|
:level => "INFO", # LOG_LEVELS = ['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'] or your customized log level
|
52
52
|
:env => "PRODUCTION",
|
53
|
-
:meta => {:once => {:first => "nested1", :another => "nested2"}}
|
53
|
+
:meta => {:once => {:first => "nested1", :another => "nested2"}},
|
54
|
+
:endpoint => "https://fqdn/logs/ingest"
|
54
55
|
}
|
55
56
|
|
56
57
|
To send logs, use "log" method. Default log level is "INFO"
|
@@ -99,7 +100,6 @@ Hostname and app name cannot be more than 80 characters.
|
|
99
100
|
1. This logger assumes that you pass in json formatted data
|
100
101
|
2. This logger is a singleton (do not create mutiple instances of the logger) even though the singleton structure is not strongly enforced.
|
101
102
|
|
102
|
-
|
103
103
|
# API
|
104
104
|
|
105
105
|
## Logdna::Ruby.new(ingestion_key, options = {})
|
@@ -115,6 +115,7 @@ Instantiates a new instance of the class it is called on. ingestion_key is requi
|
|
115
115
|
|{ :level => Log level } | 'INFO' |
|
116
116
|
|{ :env => STAGING, PRODUCTION .. etc} | Nil |
|
117
117
|
|{ :meta => metadata} | Nil |
|
118
|
+
|{ :endpoint => LogDNA Ingestion URI | 'https://logs.logdna.com/logs/ingest' |
|
118
119
|
|{ :flushtime => Log flush interval in seconds } | 0.25 seconds |
|
119
120
|
|{ :flushbyte => Log flush upper limit in bytes } | 500000 bytes ~= 0.5 megabytes |
|
120
121
|
|
data/lib/logdna.rb
CHANGED
@@ -21,11 +21,12 @@ module Logdna
|
|
21
21
|
@env = opts[:env]
|
22
22
|
@meta = opts[:meta]
|
23
23
|
@@client = nil unless defined? @@client
|
24
|
-
|
24
|
+
|
25
|
+
endpoint = opts[:endpoint] || Resources::ENDPOINT
|
25
26
|
hostname = opts[:hostname] || Socket.gethostname
|
26
27
|
ip = opts.key?(:ip) ? "&ip=#{opts[:ip]}" : ''
|
27
28
|
mac = opts.key?(:mac) ? "&mac=#{opts[:mac]}" : ''
|
28
|
-
url = "#{
|
29
|
+
url = "#{endpoint}?hostname=#{hostname}#{mac}#{ip}"
|
29
30
|
|
30
31
|
begin
|
31
32
|
if (hostname.size > Resources::MAX_INPUT_LENGTH || @app.size > Resources::MAX_INPUT_LENGTH )
|
@@ -83,6 +84,7 @@ module Logdna
|
|
83
84
|
|
84
85
|
def log(msg=nil, opts={})
|
85
86
|
loggerExist?
|
87
|
+
message = msg
|
86
88
|
message = yield if msg.nil? && block_given?
|
87
89
|
@response = @@client.buffer(message, default_opts.merge(opts).merge({
|
88
90
|
timestamp: (Time.now.to_f * 1000).to_i
|
data/lib/logdna/version.rb
CHANGED
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gun Woo Choi, Derek Zhou
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.5.2
|
150
|
+
rubygems_version: 2.5.2.3
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: LogDNA Ruby logger
|