logdna 0.0.8 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YmZmZTUwYzhjMmFjNDYxYjRkMDkwYTgzNWNiYjVlNjRjM2I0Y2EyYw==
5
- data.tar.gz: !binary |-
6
- MWMyM2U4Yzk1MDYxOTIyZGFjNTA2MDkxYzEwN2Y0MjQxNmJlZjkzNQ==
2
+ SHA1:
3
+ metadata.gz: 447bf5da9312c5a9be6739a3fcc818cd8f847f38
4
+ data.tar.gz: 7f9745d98cb994409e5c769d239254e01ce2d27f
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MmNkOWIyMDAxZjA1M2JmYzc5NDIyOTQ5ODM3MDhlMWE5MmE1ODQyNjkzYTll
10
- MTBlNzhhZGM5ZmVmMWY1Y2MxOGYyMDQ4ZDc1MzgwYTBkOWFkNjQ5YTA3NTM3
11
- NmEzZDYwZTI1NjQ1MWZlMzI4MDQzODY4MTgyYmE5NGQ4ODMxYjE=
12
- data.tar.gz: !binary |-
13
- NjdhOGNhN2JlNjM3MTFhZjcxYzkwNDc1ZGM3ZmVlZTNiNzNjYjg4ZjcxMjBj
14
- Yzk4MWY3ZDVlOWYxMGQ3MTczNjJhYjNmODM2ZDllZDU2M2Q4YzQ0YzExZDQy
15
- MjZkNjU0YjlhMTZhMzRmMThlZmE3YmMxZDhjZDAwMzczM2U4MDA=
6
+ metadata.gz: aa969ca39b5e67c94882ba20b954c6abdca39600de8a0868c53be10e62bd414442f856d9420b334ff3cf212fca92fe2a244f2ada3b98f373fd73342807a43be0
7
+ data.tar.gz: 1736031941fec54f870e82708f6312acb0a4fe09cef45f6a10ce0f7c2fdfe07606f9c5b97652fb160711e3cc54ac9c6d5da682ade9b31f38970c5b6b043161fe
data/.gitignore CHANGED
@@ -8,4 +8,4 @@
8
8
  /spec/reports/
9
9
  /tmp/
10
10
  *.gem
11
- .DS_Store
11
+ .DS_Store
data/.rspec CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+
1
2
  <p align="center">
2
3
  <a href="https://app.logdna.com">
3
4
  <img height="95" width="201" src="https://raw.githubusercontent.com/logdna/artwork/master/logo%2Bruby.png">
@@ -7,17 +8,12 @@
7
8
 
8
9
  ---
9
10
 
10
- * **[Overview](#overview)**
11
11
  * **[Installation](#installation)**
12
12
  * **[API](#api)**
13
13
  * **[Development](#development)**
14
14
  * **[Contributing](#contributing)**
15
15
  * **[License](#license)**
16
16
 
17
- # Overview
18
-
19
- This gem contains LogDNA::RubyLogger, an extension to the logger from Ruby's standard library.
20
-
21
17
  # Installation
22
18
 
23
19
  Add this line to your application's Gemfile:
@@ -34,83 +30,90 @@ Or install it yourself as:
34
30
 
35
31
  $ gem install logdna
36
32
 
33
+
34
+
37
35
  # Quick Setup
38
36
 
39
37
  After installation, call
40
38
 
41
- logger = LogDNA::RubyLogger.new(your_api_key, hostname)
39
+ logger = Logdna::Ruby.new(your_ingestion_key, options)
40
+ => #<Logdna::Ruby:0x00000000000000>
42
41
 
43
42
  to set up the logger.
44
43
 
45
- To send logs, use exactly like the logger from the Ruby standard library. For example:
44
+ Options are optional variables that may contain hostname, app name, mac address, ip address, log level specified.
45
+
46
+ options = {
47
+ :hostname => myHostName
48
+ :ip => myIpAddress
49
+ :mac => myMacAddress
50
+ :app => myAppName
51
+ :level => "INFO" # LOG_LEVELS = ['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'] or your customized log level
52
+ }
53
+
54
+
55
+ To send logs, use "log" method.
46
56
 
47
57
  require 'logdna'
48
58
 
49
- logger = LogDNA::RubyLogger.new(your_api_key, hostname)
50
- logger.level = Logger::WARN
59
+ logger = LogDNA::Ruby.new(your_ingestion_key, options)
60
+ => #<Logdna::Ruby:0x00000000000000>
51
61
 
52
- logger.debug("Created logger")
53
- logger.info("Program started")
54
- logger.warn("Nothing to do!")
62
+ logger.log('This is my first log')
63
+ => "Saved" # Saved to buffer. Ready to be flushed automatically
55
64
 
56
- path = "a_non_existent_file"
57
65
 
58
- begin
59
- File.foreach(path) do |line|
60
- unless line =~ /^(\w+) = (.*)$/
61
- logger.error("Line in wrong format: #{line.chomp}")
62
- end
63
- end
64
- rescue => err
65
- logger.fatal("Caught exception; exiting")
66
- logger.fatal(err)
67
- end
66
+ By default, it will log at the level of "INFO" unless you specified otherwise during initialzation of the logger.
67
+ You can change a particular message's log level.
68
68
 
69
- # API
69
+ logger.log('This is warn message', {:level => "WARN"})
70
+
71
+
72
+ You can also send a metadata with your message by specifying 'meta' field
73
+
74
+ logger.log('This is a message with metadata', {:meta => {:once => {:first => {"nested1", "nested2"}, "second"}}, :level => "TRACE"})
70
75
 
71
- ## ::new(api_key, hostname, options = {})
72
76
 
73
- Instantiates a new instance of the class it is called on. api_key and hostname are required.
77
+ Hostname and app name cannot be more than 80 characters.
74
78
 
75
- Options:
76
- * logdev: The log device. This is a filename (String) or IO object (e.g. STDOUT, STDERR, an open file). Default: STDOUT.
77
- * mac: MAC address. Default: nil.
78
- * ip: IP address. Default: nil.
79
- * default_app: Set a default app for this instance of the logger. Note that this can be overwritten by the progname below on the line level, as the app is a line attribute.
80
- * environment: Alias for default_app.
81
79
 
82
- __Make sure that the following options are numbers if you supply them. We are not responsible for any type errors if you enter non-numerical values for these options.__
83
80
 
84
- * shift_age: Number of old log files to keep, or frequency of rotation (daily, weekly, or monthly). Default: 7
85
- * shift_size: Maximum logfile size (only applies when shift_age is a number). Default: 1,048,576
86
- * buffer_max_size: Maximum number of lines in buffer. Default: 10
87
- * buffer_timeout: Frequency of posting requests to LogDNA. Default: 10 (seconds)
81
+ # Important Notes
88
82
 
89
- ## \#add(severity, message=nil, progname=nil) {...}
83
+ 1. This logger assumes that you pass in json formatted data
84
+ 2. This logger is a singleton (do not create mutiple instances of the logger) even though the singleton structure is not strongly enforced.
90
85
 
91
- Log a message if the given severity is high enough and post it to the LogDNA ingester. This is the generic logging method. Users will be more inclined to use debug, info, warn, error, and fatal (which all call \#add), as [described in the Ruby Logger documentation](https://ruby-doc.org/stdlib-2.3.0/libdoc/logger/rdoc/Logger.html). Note that these methods take a source as the argument and a block which returns a message, or a string/exception as an argument without a block. It returns the http response.
92
86
 
93
- ## \#close_http
94
87
 
95
- Close the HTTP connection to LogDNA's ingester.
88
+ # API
96
89
 
97
- ## \#reopen_http
90
+ ## Logdna::Ruby.new(ingestion_key, options = {})
98
91
 
99
- Open another HTTP connection to LogDNA's ingester if the connection is already closed.
92
+ Instantiates a new instance of the class it is called on. ingestion_key is required.
100
93
 
101
- ## \#<<(message)
94
+ | Options | Default |
95
+ |---------|---------|
96
+ |{ :hostname => Host name } | Device's default hostname |
97
+ |{ :mac => MAC address } | Nil |
98
+ |{ :ip => IP address } | Nil |
99
+ |{ :app => App name } | 'default' |
100
+ |{ :level => Log level } | 'INFO' |
101
+ |{ :flushtime => Log flush interval in seconds } | 0.25 seconds |
102
+ |{ :flushbyte => Log flush upper limit in bytes } | 500000 bytes ~= 0.5 megabytes |
102
103
 
103
- Dump given message to the log device without any formatting, then posts it to the LogDNA ingester. If no log device exists, return nil.
104
+ Different log level displays log messages in different colors as well.
105
+ - ![TRACE DEBUG INFO Colors](https://placehold.it/15/515151/000000?text=+) "Trace" "Debug" "Info"
106
+ - ![WARN Color](https://placehold.it/15/ec9563/000000?text=+) "Warn"
107
+ - ![ERROR Fatal Colors](https://placehold.it/15/e37e7d/000000?text=+) "Error" "Fatal"
104
108
 
105
- # Development
106
109
 
107
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
108
110
 
109
111
  # Contributing
110
112
 
111
113
  Bug reports and pull requests are welcome on GitHub at https://github.com/logdna/ruby.
112
114
 
115
+
116
+
113
117
  # License
114
118
 
115
119
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
116
-
data/Rakefile CHANGED
File without changes
@@ -0,0 +1,133 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'socket'
4
+ require 'json'
5
+ require 'concurrent'
6
+ require 'thread'
7
+ module Logdna
8
+ class Client < Thread
9
+
10
+ class ValidURLRequired < ArgumentError; end
11
+ class MaxLengthExceeded < ArgumentError; end
12
+
13
+ def initialize(key, opts)
14
+ super do
15
+ @qs = {
16
+ :hostname => (opts[:hostname] ||= Socket.gethostname),
17
+ :ip => opts.key?(:ip) ? "&ip=#{opts[:ip]}" : "",
18
+ :mac => opts.key?(:mac) ? "&mac=#{opts[:mac]}" : "",
19
+ :app => (opts[:app] ||= "default"),
20
+ :level => (opts[:level] ||= "INFO")
21
+ }
22
+
23
+ begin
24
+ if (@qs[:hostname].size > Resources::MAX_INPUT_LENGTH || @qs[:app].size > Resources::MAX_INPUT_LENGTH )
25
+ raise MaxLengthExceeded.new
26
+ end
27
+ rescue MaxLengthExceeded => e
28
+ puts "Hostname or Appname is over #{Resources::MAX_INPUT_LENGTH} characters"
29
+ self[:value] = Resources::LOGGER_NOT_CREATED
30
+ return
31
+ end
32
+
33
+ @firstbuff = []
34
+ @secondbuff = []
35
+ @currentbytesize = 0
36
+ @secondbytesize = 0
37
+ @actual_flush_interval = opts[:flushtime] ||= Resources::FLUSH_INTERVAL
38
+ @actual_byte_limit = opts[:flushbyte] ||= Resources::FLUSH_BYTE_LIMIT
39
+
40
+ @url = "#{Resources::ENDPOINT}?hostname=#{@qs[:hostname]}#{@qs[:mac]}#{@qs[:ip]}"
41
+ @semaphore = Mutex.new
42
+ begin
43
+ @uri = URI(@url)
44
+ rescue URI::ValidURIRequired => e
45
+ raise ValidURLRequired.new("Invalid URL Endpoint: #{@url}")
46
+ self[:value] = Resources::LOGGER_NOT_CREATED
47
+ return
48
+ end
49
+
50
+ @request = Net::HTTP::Post.new(@uri, 'Content-Type' => 'application/json')
51
+ @request.basic_auth 'username', key
52
+ self[:value] = Resources::LOGGER_CREATED
53
+ end
54
+ end
55
+
56
+ def tobuffer(msg, opts)
57
+ if @task
58
+ unless @task.running?
59
+ @task = Concurrent::TimerTask.new(execution_interval: @actual_flush_interval, timeout_interval: Resources::TIMER_OUT){ flush() }
60
+ @task.execute
61
+ end
62
+ else
63
+ @task = Concurrent::TimerTask.new(execution_interval: @actual_flush_interval, timeout_interval: Resources::TIMER_OUT){ flush() }
64
+ @task.execute
65
+ end
66
+
67
+ unless msg.instance_of? String
68
+ msg = msg.to_s
69
+ end
70
+
71
+ begin
72
+ msg = msg.encode("UTF-8")
73
+ rescue Encoding::UndefinedConversionError => e
74
+ raise e
75
+ end
76
+
77
+ unless @semaphore.locked?
78
+ @currentbytesize += msg.bytesize
79
+
80
+ @firstbuff.push({
81
+ :line => msg,
82
+ :app => @qs[:app],
83
+ :level => opts[:level] ||= @qs[:level],
84
+ :timestamp => Time.now.to_i,
85
+ :meta => opts[:meta] ||= nil
86
+ }.reject { |k,v| k === :meta && v.nil? })
87
+ else
88
+ @secondbytesize += msg.bytesize
89
+ @secondbuff.push({
90
+ :line => msg,
91
+ :app => @qs[:app],
92
+ :level => opts[:level] ||= @qs[:level],
93
+ :timestamp => Time.now.to_i,
94
+ :meta => opts[:meta] ||= nil
95
+ }.reject { |k,v| k === :meta && v.nil? })
96
+ end
97
+
98
+ if @actual_byte_limit < @currentbytesize
99
+ flush()
100
+ end
101
+
102
+ end
103
+
104
+ def flush()
105
+ @semaphore.synchronize {
106
+ real = {:e => 'ls', :ls => @firstbuff }.to_json
107
+ @request.body = real
108
+ @response = Net::HTTP.start(@uri.hostname, @uri.port, :use_ssl => @uri.scheme == 'https') do |http|
109
+ http.request(@request)
110
+ end
111
+ puts "Result: #{@response.body}"
112
+ @currentbytesize = @secondbytesize
113
+ @secondbytesize = 0
114
+ @firstbuff = []
115
+ @firstbuff = @firstbuff + @secondbuff
116
+ @secondbuff = []
117
+ unless @task.nil?
118
+ @task.shutdown
119
+ @task.kill
120
+ end
121
+ }
122
+ end
123
+
124
+ def exitout()
125
+ flush()
126
+ join
127
+ puts "Exiting LogDNA logger: Logging remaining messages"
128
+ return
129
+ end
130
+ end
131
+ end
132
+
133
+
@@ -0,0 +1,18 @@
1
+ module Resources
2
+
3
+ LOG_LEVELS = ['TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL'].freeze
4
+ DEFAULT_REQUEST_HEADER = { 'Content-Type': 'application/json; charset=UTF-8' }.freeze
5
+ DEFAULT_REQUEST_TIMEOUT = 180000
6
+ MS_IN_A_DAY = 86400000
7
+ MAX_REQUEST_TIMEOUT = 300000
8
+ MAX_LINE_LENGTH = 32000
9
+ MAX_INPUT_LENGTH = 80
10
+ FLUSH_INTERVAL = 0.25
11
+ TIMER_OUT = 15
12
+ FLUSH_BYTE_LIMIT = 500000
13
+ ENDPOINT = 'https://logs.logdna.com/logs/ingest'.freeze
14
+ MAC_ADDR_CHECK = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/
15
+ IP_ADDR_CHECK = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
16
+ LOGGER_NOT_CREATED = "LOGGER_NOT_CREATED"
17
+ LOGGER_CREATED = "LOGGER_CREATED"
18
+ end
@@ -1,3 +1,3 @@
1
1
  module LogDNA
2
- VERSION = '0.0.8'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
data/lib/logdna.rb CHANGED
@@ -1,139 +1,35 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- require 'json'
4
- require_relative './logdna/version.rb'
5
- require_relative './logdna/ruby_logger.rb'
6
-
7
- class Hash
8
- def to_utf8
9
- Hash[
10
- self.collect do |k, v|
11
- if (v.respond_to?(:to_utf8))
12
- [ k, v.to_utf8 ]
13
- elsif (v.respond_to?(:encoding))
14
- [ k, v.dup.encode('UTF-8') ]
15
- else
16
- [ k, v ]
3
+ require 'socket'
4
+ require_relative 'logdna/client.rb'
5
+ require_relative 'logdna/resources.rb'
6
+ module Logdna
7
+ class Ruby
8
+ def initialize(key, opts={})
9
+ @@client = Logdna::Client.new(key, opts)
10
+ sleep 0.0001
11
+ if @@client[:value] === Resources::LOGGER_NOT_CREATED
12
+ @@client = nil
13
+ puts "LogDNA logger not created"
14
+ return
15
+ end
17
16
  end
18
- end
19
- ]
20
- end
21
- end
22
-
23
- module LogDNA
24
- INGESTER_DOMAIN = 'https://logs.logdna.com'.freeze
25
-
26
- LEVELS = {
27
- 0 => 'DEBUG',
28
- 1 => 'INFO',
29
- 2 => 'WARN',
30
- 3 => 'ERROR',
31
- 4 => 'FATAL',
32
- 5 => 'UNKNOWN'
33
- }.freeze
34
-
35
- def add(severity, message = nil, progname = nil)
36
- super
37
- return true if severity < @level
38
- # Ruby Logger's author is a maniac.
39
- # The reassignment in the library is gratuitous.
40
- message ||= yield if block_given?
41
- message, progname = progname, message unless message && block_given?
42
- return unless @open
43
- push_to_buffer(message, severity, progname)
44
- end
45
-
46
- def close_http
47
- return false unless @open
48
- @conn.close
49
- @timer.exit if @timer
50
- @open = false
51
- true
52
- end
53
-
54
- def reopen_http
55
- return false if @open
56
- @conn = HTTP.persistent LogDNA::INGESTER_DOMAIN
57
- @open = true
58
- end
59
-
60
- def environment
61
- @default_app
62
- end
63
17
 
64
- def environment=(env)
65
- @default_app = env
66
- end
67
-
68
- private
69
-
70
- def fill_opts_with_defaults(opts)
71
- # defaults from ruby standard library logger documentation
72
- opts[:logdev] ||= STDOUT
73
- opts[:shift_age] ||= 7
74
- opts[:shift_size] ||= 1_048_576
75
- opts[:environment] ||= nil # alias for :default_app
76
- opts[:default_app] ||= opts[:environment]
77
- opts[:buffer_max_size] ||= 10
78
- opts[:buffer_timeout] ||= 10
79
- opts
80
- end
81
-
82
- def set_ivars(api_key, hostname, opts)
83
- raise ArgumentError 'api_key must be a string' unless api_key.is_a?(String)
84
- @api_key = api_key
85
- @host = hostname.to_s
86
- @mac = opts[:mac].to_s
87
- @ip = opts[:ip].to_s
88
- @default_app = opts[:default_app] || 'none'
89
- @buffer = []
90
- @buffer_max = opts[:buffer_max_size]
91
- @freq = opts[:buffer_timeout]
92
- @open = true
93
- end
94
-
95
- def post
96
- res = @conn.headers(apikey: @api_key, 'Content-Type' => 'application/json')
97
- .post("/logs/ingest?hostname=#{@host}&mac=#{@mac}&ip=#{@ip}",
98
- json: { e: 'ls', ls: @buffer })
99
- @buffer = []
100
- res.flush
101
- end
102
-
103
- def push_to_buffer(message, level = nil, source = nil)
104
- app = source || @default_app
105
- if message
106
- if message.class == Hash
107
- message = message.to_utf8
108
- else
109
- begin
110
- message.encode("UTF-8")
111
- rescue Encoding::UndefinedConversionError
112
- message = message.force_encoding("UTF-8")
18
+ def log(msg, opts={})
19
+ if @@client === nil
20
+ puts "Logger Not Initialized Yet"
21
+ return
113
22
  end
23
+ @response = @@client.tobuffer(msg, opts)
24
+ 'Saved'
114
25
  end
115
- else
116
- message = ''
117
- end
118
- line = { line: message, app: app, timestamp: Time.now.to_i }
119
- line[:level] = LEVELS[level] if level
120
- start_timer if @buffer.empty?
121
- @buffer << line
122
- return if @buffer.size < @buffer_max
123
- @timer.exit
124
- post
125
- end
126
26
 
127
- def start_timer
128
- @timer = Thread.new do
129
- sleep @freq
130
- unless @buffer.empty?
131
- res = @conn.headers(apikey: @api_key, 'Content-Type' => 'application/json')
132
- .post("/logs/ingest?hostname=#{@host}&mac=#{@mac}&ip=#{@ip}",
133
- json: { e: 'ls', ls: @buffer })
134
- @buffer = []
135
- res.flush
136
- end
27
+ at_exit do
28
+ unless @@client === nil
29
+ @@client.exitout()
30
+ end
31
+ exit!
32
+ end
137
33
  end
138
- end
139
34
  end
35
+
data/logdna.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'logdna/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'logdna'
8
8
  spec.version = LogDNA::VERSION
9
- spec.authors = 'Edwin Lai'
10
- spec.email = 'edwin@logdna.com'
9
+ spec.authors = 'Gun Woo Choi'
10
+ spec.email = 'matt.choi@logdna.com'
11
11
 
12
12
  spec.summary = 'LogDNA extension to ruby logger'
13
13
  spec.homepage = 'https://github.com/logdna/ruby'
@@ -20,7 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_runtime_dependency 'http', '~> 2.0'
23
+ spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0.5'
24
+ spec.add_runtime_dependency 'json', '~> 2.0.2'
25
+ spec.add_runtime_dependency 'openssl', '~> 2.0.3'
24
26
 
25
27
  spec.add_development_dependency 'bundler', '~> 1.13'
26
28
  spec.add_development_dependency 'rake', '~> 10.5'
metadata CHANGED
@@ -1,101 +1,128 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logdna
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Edwin Lai
7
+ - Gun Woo Choi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-24 00:00:00.000000000 Z
11
+ date: 2017-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: http
14
+ name: concurrent-ruby
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: 1.0.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: 1.0.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.2
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: openssl
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.3
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.0.3
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: bundler
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - ~>
59
+ - - "~>"
32
60
  - !ruby/object:Gem::Version
33
61
  version: '1.13'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - ~>
66
+ - - "~>"
39
67
  - !ruby/object:Gem::Version
40
68
  version: '1.13'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: rake
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - ~>
73
+ - - "~>"
46
74
  - !ruby/object:Gem::Version
47
75
  version: '10.5'
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - ~>
80
+ - - "~>"
53
81
  - !ruby/object:Gem::Version
54
82
  version: '10.5'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rspec
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - ~>
87
+ - - "~>"
60
88
  - !ruby/object:Gem::Version
61
89
  version: '3.5'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - ~>
94
+ - - "~>"
67
95
  - !ruby/object:Gem::Version
68
96
  version: '3.5'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: webmock
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - ~>
101
+ - - "~>"
74
102
  - !ruby/object:Gem::Version
75
103
  version: '2.3'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - ~>
108
+ - - "~>"
81
109
  - !ruby/object:Gem::Version
82
110
  version: '2.3'
83
111
  description:
84
- email: edwin@logdna.com
112
+ email: matt.choi@logdna.com
85
113
  executables: []
86
114
  extensions: []
87
115
  extra_rdoc_files: []
88
116
  files:
89
- - .gitignore
90
- - .rspec
117
+ - ".gitignore"
118
+ - ".rspec"
91
119
  - Gemfile
92
120
  - LICENSE.txt
93
121
  - README.md
94
122
  - Rakefile
95
- - bin/console
96
- - bin/setup
97
123
  - lib/logdna.rb
98
- - lib/logdna/ruby_logger.rb
124
+ - lib/logdna/client.rb
125
+ - lib/logdna/resources.rb
99
126
  - lib/logdna/version.rb
100
127
  - logdna.gemspec
101
128
  homepage: https://github.com/logdna/ruby
@@ -108,12 +135,12 @@ require_paths:
108
135
  - lib
109
136
  required_ruby_version: !ruby/object:Gem::Requirement
110
137
  requirements:
111
- - - ! '>='
138
+ - - ">="
112
139
  - !ruby/object:Gem::Version
113
140
  version: '0'
114
141
  required_rubygems_version: !ruby/object:Gem::Requirement
115
142
  requirements:
116
- - - ! '>='
143
+ - - ">="
117
144
  - !ruby/object:Gem::Version
118
145
  version: '0'
119
146
  requirements: []
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "logdna"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,23 +0,0 @@
1
- require 'logger'
2
- require 'http'
3
-
4
- module LogDNA
5
- class RubyLogger < ::Logger
6
- include LogDNA
7
-
8
- attr_reader :open
9
- attr_accessor :api_key, :host, :default_app, :ip, :mac
10
-
11
- def initialize(api_key, hostname, options = {})
12
- @conn = HTTP.persistent LogDNA::INGESTER_DOMAIN
13
- opts = fill_opts_with_defaults(options)
14
- super(opts[:logdev], opts[:shift_age], opts[:shift_size])
15
- set_ivars(api_key, hostname, options)
16
- end
17
-
18
- def <<(msg)
19
- super
20
- push_to_buffer(msg)
21
- end
22
- end
23
- end