-
Notifications
You must be signed in to change notification settings - Fork 18
Add internal logger and tests #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
94 commits
Select commit
Hold shift + click to select a range
b1d402f
working on the scheduler
lvilya 68ffd7e
savingBranch
lvilya 888404c
add bin folder to gitignore
lvilya 37c6a3b
remive all bin folder changes"
lvilya 08ad8d9
add tests
lvilya e980151
remove spec folder
lvilya 9c7aaca
remove unused method
lvilya 49d95da
add the flush flag check
lvilya b1a7d67
not working here??
lvilya 10aeea0
not working chnges
lvilya 6a3fb05
address the comments and improve the excpetion handling logic
lvilya 6ff863e
add rubycop config file and run it
lvilya 09f725b
change the oprand
lvilya a95a79d
forgot about one more
lvilya c75b9c0
address comments
lvilya f04c058
lints
lvilya 25750ad
change the locking logic ang change linting rules
lvilya 4e04773
add lamda for excpetion handling
lvilya 112d3e8
check lock owning
lvilya 481cc5c
fix the bug and add the lock to the side messages
lvilya fa4841e
lints
lvilya 60a3707
remove redundant nil
lvilya 207def1
remove the checking
lvilya 1f61ebf
move the falg into lock
lvilya 3024922
remove block
lvilya 48ec1a6
rubocop
lvilya a827d99
forgot to move another flag swtich into the lock block
lvilya 99b25aa
restore the possibility to pass blocks as messages
lvilya e1b66ad
change the logic to read easier
lvilya 6c57f91
update rubocop although it didd not have any effect. rubocop is stupid.
lvilya e1b965d
commit
lvilya 237cff3
sdfsdf
lvilya 74adad2
sdfsdF
lvilya 672f527
fix the dep
lvilya a9089bc
address the comments
lvilya b655cfd
remove the stray debug message
lvilya 9522257
gitigone
lvilya a89ab46
dd
lvilya 1ace81f
dss
lvilya 96024f5
adds tests
lvilya 6ecb59f
rubocop
lvilya 7c518d4
lints
lvilya 7800ad4
remove puts
lvilya 7fc3c4c
gitingone
lvilya 5f156e6
clean
lvilya 4531dc2
working on the scheduler
lvilya a7b236a
savingBranch
lvilya 4f65eda
the final test is insihed
lvilya 857f4e2
add bin folder to gitignore
lvilya 580406c
remive all bin folder changes"
lvilya 78efc61
add tests
lvilya 108e61c
remove spec folder
lvilya 2637024
address the comments and improve the excpetion handling logic
lvilya b5bc0a6
add rubycop config file and run it
lvilya 230bf72
address comments
lvilya f1a67d4
lints
lvilya 2871c0e
change the locking logic ang change linting rules
lvilya babec9d
check lock owning
lvilya 6b110f3
fix the bug and add the lock to the side messages
lvilya d25e512
rubocop
lvilya 5c3b7de
forgot to move another flag swtich into the lock block
lvilya ebcbeb9
commit
lvilya e840e35
address the comments
lvilya 681c53d
remove the stray debug message
lvilya 54b0839
gitigone
lvilya 12d3803
dd
lvilya df4943c
dss
lvilya b60d0e5
adds tests
lvilya 07da391
rubocop
lvilya 48edb37
lints
lvilya b958c36
remove puts
lvilya 09aeae5
gitingone
lvilya a12b709
clean
lvilya 0e23733
ddD
lvilya 7c785a9
clean
lvilya 5130fb6
ss
lvilya 7f51d31
sss
lvilya 515336a
ahahahahaha rubocop stupd
lvilya c3308a3
rubocop and refacyor the test server
lvilya c2b176d
use send method
lvilya 863acd1
rubocop
lvilya f528e7d
add one more linting rule
lvilya bfcdfff
remove the commented libnes and + = replace with +=
a464953
add the space for = +
47727f0
changed.
lvilya ce29df4
resolve conflicts
lvilya c3acefb
resolve logdna.gemspec changes
lvilya 73caade
conflicts and remove the version.rb file read from a regular file ins…
lvilya 00b7fc6
dont require the version file in gemspec
lvilya f4fb072
rubocop
lvilya d182de9
fix the rubocop compalin
lvilya edbe6ae
will it fix
lvilya 5e78765
remove unrecognized linting rules
lvilya 359ca58
remove .freeze that was added afte merging
lvilya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| source 'https://rubygems.org' | ||
| # frozen_string_literal: true | ||
|
|
||
| source "https://rubygems.org" | ||
|
|
||
| # Specify your gem's dependencies in logdna_ruby.gemspec | ||
| gemspec | ||
| gem "minitest" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,17 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Resources | ||
| LOG_LEVELS = ['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'TRACE'].freeze | ||
| DEFAULT_REQUEST_HEADER = { 'Content-Type' => 'application/json; charset=UTF-8' }.freeze | ||
| DEFAULT_REQUEST_TIMEOUT = 180000 | ||
| MS_IN_A_DAY = 86400000 | ||
| MAX_REQUEST_TIMEOUT = 300000 | ||
| MAX_LINE_LENGTH = 32000 | ||
| LOG_LEVELS = %w[DEBUG INFO WARN ERROR FATAL TRACE] | ||
| DEFAULT_REQUEST_HEADER = { "Content-Type" => "application/json; charset=UTF-8" } | ||
| DEFAULT_REQUEST_TIMEOUT = 180_000 | ||
| MS_IN_A_DAY = 86_400_000 | ||
| MAX_REQUEST_TIMEOUT = 300_000 | ||
| MAX_LINE_LENGTH = 32_000 | ||
| MAX_INPUT_LENGTH = 80 | ||
| RETRY_TIMEOUT = 60 | ||
| FLUSH_INTERVAL = 0.25 | ||
| FLUSH_BYTE_LIMIT = 500000 | ||
| ENDPOINT = 'https://logs.logdna.com/logs/ingest'.freeze | ||
| FLUSH_BYTE_LIMIT = 500_000 | ||
| ENDPOINT = "https://logs.logdna.com/logs/ingest" | ||
| MAC_ADDR_CHECK = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/ | ||
| 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]?)$/ | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module LogDNA | ||
| VERSION = '1.3.0'.freeze | ||
| VERSION = "1.3.0" | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,23 @@ | ||
| # coding: utf-8 | ||
| lib = File.expand_path('../lib', __FILE__) | ||
| # frozen_string_literal: true | ||
|
|
||
| lib = File.expand_path("lib", __dir__) | ||
| $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
| require 'logdna/version' | ||
| version = File.open("lib/logdna/version.rb").read.scan(/"([^"]*)"/).first.first | ||
|
|
||
| Gem::Specification.new do |spec| | ||
| spec.name = 'logdna' | ||
| spec.version = LogDNA::VERSION | ||
| spec.authors = 'Gun Woo Choi, Derek Zhou, Vilya Levitskiy, Muaz Siddiqui' | ||
| spec.email = 'support@logdna.com' | ||
| spec.summary = 'LogDNA Ruby logger' | ||
| spec.homepage = 'https://github.com/logdna/ruby' | ||
| spec.license = 'MIT' | ||
| spec.files = Dir.glob("{lib}/**/*.rb") + %w(LICENSE README.md) | ||
| spec.bindir = 'exe' | ||
| spec.name = "logdna" | ||
| spec.version = version | ||
| spec.authors = "Gun Woo Choi, Derek Zhou, Vilya Levitskiy, Muaz Siddiqui" | ||
| spec.email = "support@logdna.com" | ||
| spec.summary = "LogDNA Ruby logger" | ||
| spec.homepage = "https://github.com/logdna/ruby" | ||
| spec.license = "MIT" | ||
| spec.files = Dir.glob("{lib}/**/*.rb") + %w[LICENSE README.md] | ||
| spec.bindir = "exe" | ||
| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
| spec.require_paths = ['lib'] | ||
| spec.add_runtime_dependency 'concurrent-ruby', '~> 1.0' | ||
| spec.add_runtime_dependency 'require_all', '~> 1.4' | ||
| spec.add_runtime_dependency 'json', '~> 2.0' | ||
| spec.add_development_dependency 'rubocop', '~> 0.78' | ||
| spec.require_paths = ["lib"] | ||
| spec.add_runtime_dependency "concurrent-ruby", "~> 1.0" | ||
| spec.add_runtime_dependency "json", "~> 2.0" | ||
| spec.add_runtime_dependency "require_all", "~> 1.4" | ||
| spec.add_development_dependency "rubocop", "~> 0.78" | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require "socket" | ||
|
|
||
| class TestServer | ||
| def start_server(port) | ||
| server = TCPServer.new(port) | ||
| puts server | ||
| data = "" | ||
|
|
||
| Thread.start(server.accept) { |client| | ||
| headers = {} | ||
| while line = client.gets.split(" ", 2) | ||
| break if line[0] == "" | ||
|
|
||
| headers[line[0].chop] = line[1].strip | ||
| end | ||
| data = client.read(headers["Content-Length"].to_i) | ||
| client.puts("HTTP/1.1 200 OK") | ||
| client.close | ||
| }.join | ||
|
|
||
| eval(data) | ||
| end | ||
|
|
||
| def accept_logs_and_respond(server, data, res) | ||
| Thread.start(server.accept) { |client| | ||
| headers = {} | ||
| while line = client.gets.split(" ", 2) | ||
| break if line[0] == "" | ||
|
|
||
| headers[line[0].chop] = line[1].strip | ||
| end | ||
| data += client.read(headers["Content-Length"].to_i) | ||
| client.puts(res) | ||
| client.close | ||
| }.join | ||
|
|
||
| data | ||
| end | ||
|
|
||
| def return_not_found_res(port) | ||
| server = TCPServer.new(port) | ||
| data = "" | ||
| accept_logs_and_respond(server, data, "HTTP/1.1 404 Not Found") | ||
| data += accept_logs_and_respond(server, data, "HTTP/1.1 200 OK") | ||
|
|
||
| eval(data) | ||
| end | ||
| end | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.