ree_lib 1.0.4 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/lib/ree_lib/packages/ree_logger/Package.schema.json +3 -0
- data/lib/ree_lib/packages/ree_logger/package/ree_logger/appenders/rollbar_appender.rb +79 -0
- data/lib/ree_lib/packages/ree_logger/package/ree_logger/beans/logger.rb +14 -0
- data/lib/ree_lib/packages/ree_logger/package/ree_logger/config.rb +10 -0
- data/lib/ree_lib/packages/ree_logger/package/ree_logger/multi_logger.rb +8 -0
- data/lib/ree_lib/packages/ree_logger/package/ree_logger.rb +1 -0
- data/lib/ree_lib/packages/ree_logger/spec/ree_logger/appenders/rollbar_appender_spec.rb +33 -0
- data/lib/ree_lib/packages/ree_logger/spec/ree_logger/beans/logger_spec.rb +14 -3
- data/lib/ree_lib/packages/ree_logger/spec/ree_logger/multi_logger_spec.rb +32 -8
- data/lib/ree_lib/packages/ree_logger/spec/spec_helper.rb +5 -1
- data/lib/ree_lib/packages/ree_migrator/spec/spec_helper.rb +2 -1
- data/lib/ree_lib/packages/ree_swagger/package/ree_swagger/dto/endpoint_dto.rb +1 -0
- data/lib/ree_lib/packages/ree_swagger/package/ree_swagger/functions/build_endpoint_schema.rb +5 -2
- data/lib/ree_lib/packages/ree_swagger/spec/functions/build_endpoint_schema_spec.rb +8 -2
- data/lib/ree_lib/packages/ree_swagger/spec/functions/build_schema_spec.rb +1 -0
- data/lib/ree_lib/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 956fffa1a41176330384decf8f4f3b45ce70801785ea5498a07e0cb0afdd6b0f
|
|
4
|
+
data.tar.gz: 4745a3465a5ad18a6353ba21a8ef62b13991cd3cfc0fde7bf05ec41c7e561433
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: afd9719357108c5bff745a3112c581f333de679e0ac9d41e02624d43f006584cdfec1080f40047be3fcfb816ea74275509ca2a841e718c06463e489d32e7a473
|
|
7
|
+
data.tar.gz: 398d3fc0469aa20e71d37eaaf6422c76f8a0a86d155d548199bff1867a27612f0602ea7919715efd1aaf4f479417a2f03e2254d2e9ff4ba09b97fd2d1250632a
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ree_lib (1.0.
|
|
4
|
+
ree_lib (1.0.7)
|
|
5
5
|
binding_of_caller (~> 1.0.0)
|
|
6
6
|
i18n (~> 1.12.0)
|
|
7
7
|
loofah (~> 2.18.0)
|
|
@@ -36,8 +36,6 @@ GEM
|
|
|
36
36
|
crass (~> 1.0.2)
|
|
37
37
|
nokogiri (>= 1.5.9)
|
|
38
38
|
msgpack (1.5.4)
|
|
39
|
-
nokogiri (1.13.8-x86_64-darwin)
|
|
40
|
-
racc (~> 1.4)
|
|
41
39
|
nokogiri (1.13.8-x86_64-linux)
|
|
42
40
|
racc (~> 1.4)
|
|
43
41
|
oj (3.13.19)
|
|
@@ -46,9 +44,10 @@ GEM
|
|
|
46
44
|
racc (1.6.0)
|
|
47
45
|
rainbow (3.1.1)
|
|
48
46
|
rake (13.0.6)
|
|
49
|
-
ree (1.0.
|
|
47
|
+
ree (1.0.3)
|
|
50
48
|
commander (~> 4.6.0)
|
|
51
49
|
rexml (3.2.5)
|
|
50
|
+
rollbar (3.3.1)
|
|
52
51
|
rspec (3.11.0)
|
|
53
52
|
rspec-core (~> 3.11.0)
|
|
54
53
|
rspec-expectations (~> 3.11.0)
|
|
@@ -82,6 +81,7 @@ DEPENDENCIES
|
|
|
82
81
|
pg (~> 1.4.1)
|
|
83
82
|
rake (~> 13.0)
|
|
84
83
|
ree_lib!
|
|
84
|
+
rollbar (~> 3.3.1)
|
|
85
85
|
rspec
|
|
86
86
|
sqlite3 (~> 1.4.4)
|
|
87
87
|
timecop (~> 0.9.5)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'appender'
|
|
4
|
+
require 'digest'
|
|
5
|
+
|
|
6
|
+
class ReeLogger::RollbarAppender < ReeLogger::Appender
|
|
7
|
+
include Ree::LinkDSL
|
|
8
|
+
|
|
9
|
+
link 'ree_logger/log_event', -> { LogEvent }
|
|
10
|
+
|
|
11
|
+
contract(
|
|
12
|
+
Symbol,
|
|
13
|
+
Kwargs[
|
|
14
|
+
access_token: String,
|
|
15
|
+
environment: String,
|
|
16
|
+
],
|
|
17
|
+
Ksplat[
|
|
18
|
+
branch?: Nilor[String],
|
|
19
|
+
host?: Nilor[String],
|
|
20
|
+
] => Any
|
|
21
|
+
)
|
|
22
|
+
def initialize(level, access_token:, environment:, **opts)
|
|
23
|
+
super(level, nil)
|
|
24
|
+
|
|
25
|
+
require 'rollbar'
|
|
26
|
+
|
|
27
|
+
Rollbar.configure do |config|
|
|
28
|
+
config.enabled = true
|
|
29
|
+
config.access_token = access_token
|
|
30
|
+
config.environment = environment
|
|
31
|
+
config.branch = opts[:branch] if opts[:branch]
|
|
32
|
+
config.host = opts[:host] if opts[:host]
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
contract(LogEvent, Nilor[String] => nil)
|
|
37
|
+
def append(event, progname = nil)
|
|
38
|
+
rollbar_level =
|
|
39
|
+
case event.level
|
|
40
|
+
when :fatal
|
|
41
|
+
'critical'
|
|
42
|
+
when :unknown
|
|
43
|
+
'critical'
|
|
44
|
+
else
|
|
45
|
+
event.level.to_s
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
fingerprint = event.message.to_s
|
|
49
|
+
|
|
50
|
+
if event.exception
|
|
51
|
+
fingerprint += event.exception.class.to_s
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
scope = {}
|
|
55
|
+
parameters = event.parameters.dup
|
|
56
|
+
|
|
57
|
+
if parameters.key?(:rollbar_scope) && parameters[:rollbar_scope].is_a?(Hash)
|
|
58
|
+
scope = scope.merge(
|
|
59
|
+
parameters.delete(:rollbar_scope)
|
|
60
|
+
)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
if !scope[:fingerprint]
|
|
64
|
+
fingerprint = event.message.to_s
|
|
65
|
+
|
|
66
|
+
if event.exception
|
|
67
|
+
fingerprint += event.exception.class.to_s
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
scope[:fingerprint] = Digest::MD5.new.update(fingerprint).to_s
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
Rollbar.scoped(scope) do
|
|
74
|
+
Rollbar.log(rollbar_level, event.message, event.exception, parameters)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
nil
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -14,6 +14,7 @@ class ReeLogger::Logger
|
|
|
14
14
|
link 'ree_logger/rate_limiter', -> { RateLimiter }
|
|
15
15
|
link 'ree_logger/appenders/file_appender', -> { FileAppender }
|
|
16
16
|
link 'ree_logger/appenders/stdout_appender', -> { StdoutAppender }
|
|
17
|
+
link 'ree_logger/appenders/rollbar_appender', -> { RollbarAppender }
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def build
|
|
@@ -35,6 +36,19 @@ class ReeLogger::Logger
|
|
|
35
36
|
)
|
|
36
37
|
end
|
|
37
38
|
|
|
39
|
+
if config.rollbar.enabled
|
|
40
|
+
opts = {}
|
|
41
|
+
opts[:branch] = config.rollbar.branch if config.rollbar.branch
|
|
42
|
+
opts[:host] = config.rollbar.host if config.rollbar.host
|
|
43
|
+
|
|
44
|
+
appenders << RollbarAppender.new(
|
|
45
|
+
config.levels.rollbar,
|
|
46
|
+
access_token: config.rollbar.access_token,
|
|
47
|
+
environment: config.rollbar.environment,
|
|
48
|
+
**opts
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
38
52
|
build_logger(
|
|
39
53
|
appenders,
|
|
40
54
|
ENV['APP_NAME'],
|
|
@@ -17,12 +17,22 @@ class ReeLogger::Config
|
|
|
17
17
|
RATE_LIMIT_MAX_COUNT = 600
|
|
18
18
|
|
|
19
19
|
def build
|
|
20
|
+
is_rollbar_enabled = parse_bool_string(ENV['LOG_ROLLBAR_ENABLED'])
|
|
21
|
+
|
|
20
22
|
to_obj({
|
|
21
23
|
file_path: ENV['LOG_FILE_PATH'],
|
|
22
24
|
file_auto_flush: parse_bool_string(ENV['LOG_FILE_AUTO_FLUSH']),
|
|
23
25
|
levels: {
|
|
24
26
|
file: parse_level(ENV['LOG_LEVEL_FILE']),
|
|
25
27
|
stdout: parse_level(ENV['LOG_LEVEL_STDOUT']),
|
|
28
|
+
rollbar: is_rollbar_enabled ? parse_level(ENV['LOG_LEVEL_ROLLBAR']) : nil,
|
|
29
|
+
},
|
|
30
|
+
rollbar: {
|
|
31
|
+
enabled: is_rollbar_enabled,
|
|
32
|
+
access_token: is_rollbar_enabled ? ENV.fetch('LOG_ROLLBAR_ACCESS_TOKEN') : nil,
|
|
33
|
+
environment: is_rollbar_enabled ? ENV.fetch('LOG_ROLLBAR_ENVIRONMENT') : nil,
|
|
34
|
+
branch: ENV['LOG_ROLLBAR_BRANCH'],
|
|
35
|
+
host: ENV['LOG_ROLLBAR_HOST']
|
|
26
36
|
},
|
|
27
37
|
rate_limit: {
|
|
28
38
|
interval: get_int_value('LOG_RATE_LIMIT_INTERVAL', RATE_LIMIT_INTERVAL),
|
|
@@ -134,6 +134,14 @@ class ReeLogger::MultiLogger < Logger
|
|
|
134
134
|
end
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
+
parameters = transform_values(parameters) do |k, v|
|
|
138
|
+
if @filter_words.any? { k.to_s.include?(_1) }
|
|
139
|
+
'FILTERED'
|
|
140
|
+
else
|
|
141
|
+
v
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
137
145
|
event = LogEvent.new(level, message, exception, parameters)
|
|
138
146
|
|
|
139
147
|
appenders.each do |appender|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#frozen_string_literal = true
|
|
2
|
+
|
|
3
|
+
package_require('ree_logger/appenders/rollbar_appender')
|
|
4
|
+
|
|
5
|
+
RSpec.describe ReeLogger::RollbarAppender do
|
|
6
|
+
let(:rollbar_appender) { described_class }
|
|
7
|
+
|
|
8
|
+
let(:log_event) {
|
|
9
|
+
ReeLogger::LogEvent.new(
|
|
10
|
+
:info,
|
|
11
|
+
"Some message",
|
|
12
|
+
nil,
|
|
13
|
+
{}
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
# comment "before" block to test sending to api
|
|
18
|
+
before do
|
|
19
|
+
allow(Rollbar).to receive(:log)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "sends log event to Rollbar" do
|
|
23
|
+
appender = rollbar_appender.new(
|
|
24
|
+
:info,
|
|
25
|
+
access_token: ENV['LOG_ROLLBAR_ACCESS_TOKEN'],
|
|
26
|
+
environment: ENV['LOG_ROLLBAR_ENVIRONMENT']
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
expect(appender).to respond_to(:append)
|
|
30
|
+
expect { appender.append(log_event) }.not_to raise_error
|
|
31
|
+
expect(Rollbar).to have_received(:log)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -8,12 +8,16 @@ RSpec.describe :logger do
|
|
|
8
8
|
|
|
9
9
|
before(:all) do
|
|
10
10
|
tmp_file_log = ENV['LOG_FILE_PATH']
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
if !is_blank(tmp_file_log)
|
|
13
13
|
File.open(tmp_file_log, 'w') {|file| file.truncate(0) }
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
before(:each) do
|
|
18
|
+
allow(Rollbar).to receive(:log)
|
|
19
|
+
end
|
|
20
|
+
|
|
17
21
|
let(:log_file_path) { ENV['LOG_FILE_PATH'] }
|
|
18
22
|
|
|
19
23
|
let(:exception) {
|
|
@@ -22,21 +26,25 @@ RSpec.describe :logger do
|
|
|
22
26
|
|
|
23
27
|
it {
|
|
24
28
|
expect { logger.info('hello world') }.to output(/hello world/).to_stdout
|
|
29
|
+
expect(Rollbar).to have_received(:log)
|
|
25
30
|
expect(File.read(log_file_path)).to match("hello world")
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
it {
|
|
29
|
-
expect { logger.info('hello world', { param: 1, another_param: { name: 'John'} }) }.to output(/John/).to_stdout
|
|
34
|
+
expect { logger.info('hello world', { rollbar_scope: {fingerprint: 'test', test: 'test'}, param: 1, another_param: { name: 'John'} }) }.to output(/John/).to_stdout
|
|
35
|
+
expect(Rollbar).to have_received(:log)
|
|
30
36
|
expect(File.read(log_file_path)).to match("John")
|
|
31
37
|
}
|
|
32
|
-
|
|
38
|
+
|
|
33
39
|
it {
|
|
34
40
|
expect { logger.debug('debug message') }.to_not output(/debug message/).to_stdout
|
|
41
|
+
expect(Rollbar).not_to have_received(:log)
|
|
35
42
|
expect(File.read(log_file_path)).to_not match("debug")
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
it {
|
|
39
46
|
expect { logger.warn('warning message') }.to output(/warning message/).to_stdout
|
|
47
|
+
expect(Rollbar).to have_received(:log)
|
|
40
48
|
expect(File.read(log_file_path)).to match("warning message")
|
|
41
49
|
}
|
|
42
50
|
|
|
@@ -46,17 +54,20 @@ RSpec.describe :logger do
|
|
|
46
54
|
}
|
|
47
55
|
expect(output).to match(/some error message/)
|
|
48
56
|
expect(output).to_not match(/method|args/)
|
|
57
|
+
expect(Rollbar).to have_received(:log)
|
|
49
58
|
expect(File.read(log_file_path)).to match("some error message")
|
|
50
59
|
expect(File.read(log_file_path)).to_not match("PARAMETERS: {:method=>{:name=>:call, :args=>{:block=>{}}}}")
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
it {
|
|
54
63
|
expect { logger.fatal('some fatal message', {}, exception) }.to output(/some fatal message/).to_stdout
|
|
64
|
+
expect(Rollbar).to have_received(:log)
|
|
55
65
|
expect(File.read(log_file_path)).to match("some fatal message")
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
it {
|
|
59
69
|
expect { logger.unknown('unknown message') }.to output(/unknown message/).to_stdout
|
|
70
|
+
expect(Rollbar).to have_received(:log)
|
|
60
71
|
expect(File.read(log_file_path)).to match("unknown message")
|
|
61
72
|
}
|
|
62
73
|
end
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
#frozen_string_literal = true
|
|
2
2
|
|
|
3
|
+
require 'rollbar'
|
|
3
4
|
package_require('ree_logger/multi_logger')
|
|
4
5
|
package_require('ree_logger/appenders/stdout_appender')
|
|
5
6
|
package_require('ree_logger/appenders/file_appender')
|
|
7
|
+
package_require('ree_logger/appenders/rollbar_appender')
|
|
6
8
|
|
|
7
9
|
RSpec.describe ReeLogger::MultiLogger do
|
|
8
10
|
link :is_blank, from: :ree_object
|
|
9
11
|
|
|
10
12
|
before(:all) do
|
|
11
13
|
tmp_file_log = ENV['LOG_FILE_PATH']
|
|
12
|
-
|
|
14
|
+
|
|
13
15
|
if !is_blank(tmp_file_log)
|
|
14
16
|
File.open(tmp_file_log, 'w') {|file| file.truncate(0) }
|
|
15
17
|
end
|
|
@@ -37,6 +39,14 @@ RSpec.describe ReeLogger::MultiLogger do
|
|
|
37
39
|
)
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
let(:rollbar_appender) {
|
|
43
|
+
ReeLogger::RollbarAppender.new(
|
|
44
|
+
:info,
|
|
45
|
+
access_token: ENV['LOG_ROLLBAR_ACCESS_TOKEN'],
|
|
46
|
+
environment: ENV['LOG_ROLLBAR_ENVIRONMENT']
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
40
50
|
let(:logger) {
|
|
41
51
|
multi_logger.new(
|
|
42
52
|
'SomeCoolApp',
|
|
@@ -46,37 +56,47 @@ RSpec.describe ReeLogger::MultiLogger do
|
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
let(:logger_with_appenders) {
|
|
49
|
-
[file_appender, stdout_appender].map { logger.add_appender(_1) }
|
|
59
|
+
[file_appender, stdout_appender, rollbar_appender].map { logger.add_appender(_1) }
|
|
50
60
|
|
|
51
61
|
logger
|
|
52
62
|
}
|
|
53
63
|
|
|
64
|
+
before(:each) do
|
|
65
|
+
allow(Rollbar).to receive(:log)
|
|
66
|
+
end
|
|
67
|
+
|
|
54
68
|
it {
|
|
55
69
|
expect { logger.add_appender(stdout_appender) }.to change { logger.appenders }
|
|
56
70
|
}
|
|
57
71
|
|
|
58
72
|
it {
|
|
59
73
|
expect { logger.info('any message') }.to_not output(/any message/).to_stdout
|
|
60
|
-
expect(
|
|
74
|
+
expect(Rollbar).not_to have_received(:log)
|
|
75
|
+
expect(File.read(log_file_path)).to_not match('any message')
|
|
61
76
|
}
|
|
62
77
|
|
|
63
78
|
it {
|
|
64
79
|
expect { logger_with_appenders.info('hello world') }.to output(/hello world/).to_stdout
|
|
65
|
-
expect(
|
|
80
|
+
expect(Rollbar).to have_received(:log)
|
|
81
|
+
expect(File.read(log_file_path)).to match("hello world")
|
|
66
82
|
}
|
|
67
83
|
|
|
68
84
|
it {
|
|
69
|
-
expect { logger_with_appenders.info('hello world', { param: 1, another_param: { name: 'John'} }) }.to output(/John/).to_stdout
|
|
85
|
+
expect { logger_with_appenders.info('hello world', { param: 1, another_param: { name: 'John'}, password: 'password01' }) }.to output(/John/).to_stdout
|
|
86
|
+
expect(Rollbar).to have_received(:log)
|
|
70
87
|
expect(File.read(log_file_path)).to match("John")
|
|
88
|
+
expect(File.read(log_file_path)).to match(":password=>\"FILTERED\"")
|
|
71
89
|
}
|
|
72
|
-
|
|
90
|
+
|
|
73
91
|
it {
|
|
74
92
|
expect { logger_with_appenders.debug('debug message') }.to_not output(/debug message/).to_stdout
|
|
93
|
+
expect(Rollbar).not_to have_received(:log)
|
|
75
94
|
expect(File.read(log_file_path)).to_not match("debug")
|
|
76
95
|
}
|
|
77
96
|
|
|
78
97
|
it {
|
|
79
98
|
expect { logger_with_appenders.warn('warning message') }.to output(/warning message/).to_stdout
|
|
99
|
+
expect(Rollbar).to have_received(:log)
|
|
80
100
|
expect(File.read(log_file_path)).to match("warning message")
|
|
81
101
|
}
|
|
82
102
|
|
|
@@ -87,16 +107,20 @@ RSpec.describe ReeLogger::MultiLogger do
|
|
|
87
107
|
expect(output).to match(/some error message/)
|
|
88
108
|
expect(output).to_not match(/method|args/)
|
|
89
109
|
expect(File.read(log_file_path)).to match("some error message")
|
|
110
|
+
expect(Rollbar).to have_received(:log)
|
|
90
111
|
expect(File.read(log_file_path)).to_not match("PARAMETERS: {:method=>{:name=>:call, :args=>{:block=>{}}}}")
|
|
91
112
|
}
|
|
92
113
|
|
|
93
114
|
it {
|
|
94
|
-
expect { logger_with_appenders.fatal('some fatal message', {}, exception) }.to output(/some fatal message/).to_stdout
|
|
115
|
+
expect { logger_with_appenders.fatal('some fatal message', { email: 'some@mail.com', password: 'password01' }, exception) }.to output(/some fatal message/).to_stdout
|
|
116
|
+
expect(Rollbar).to have_received(:log)
|
|
95
117
|
expect(File.read(log_file_path)).to match("some fatal message")
|
|
118
|
+
expect(File.read(log_file_path)).to match(":password=>\"FILTERED\"")
|
|
96
119
|
}
|
|
97
120
|
|
|
98
121
|
it {
|
|
99
122
|
expect { logger_with_appenders.unknown('unknown message') }.to output(/unknown message/).to_stdout
|
|
123
|
+
expect(Rollbar).to have_received(:log)
|
|
100
124
|
expect(File.read(log_file_path)).to match("unknown message")
|
|
101
125
|
}
|
|
102
126
|
|
|
@@ -113,5 +137,5 @@ RSpec.describe ReeLogger::MultiLogger do
|
|
|
113
137
|
}.to_not output.to_stdout
|
|
114
138
|
}
|
|
115
139
|
|
|
116
|
-
|
|
140
|
+
|
|
117
141
|
end
|
|
@@ -15,5 +15,9 @@ ENV['LOG_FILE_PATH'] = '/tmp/ree_logger.log'
|
|
|
15
15
|
ENV['LOG_FILE_AUTO_FLUSH'] = 'true'
|
|
16
16
|
ENV['LOG_LEVEL_FILE'] = 'info'
|
|
17
17
|
ENV['LOG_LEVEL_STDOUT'] = 'info'
|
|
18
|
+
ENV['LOG_LEVEL_ROLLBAR'] = 'info'
|
|
18
19
|
ENV['LOG_RATE_LIMIT_INTERVAL'] = '60'
|
|
19
|
-
ENV['LOG_RATE_LIMIT_COUNT'] = '600'
|
|
20
|
+
ENV['LOG_RATE_LIMIT_COUNT'] = '600'
|
|
21
|
+
ENV['LOG_ROLLBAR_ACCESS_TOKEN'] = 'SET_YOUR_TOKEN'
|
|
22
|
+
ENV['LOG_ROLLBAR_ENABLED'] = 'true'
|
|
23
|
+
ENV['LOG_ROLLBAR_ENVIRONMENT'] = 'test'
|
data/lib/ree_lib/packages/ree_swagger/package/ree_swagger/functions/build_endpoint_schema.rb
CHANGED
|
@@ -14,7 +14,7 @@ class ReeSwagger::BuildEndpointSchema
|
|
|
14
14
|
METHODS_WITH_BODY = [:post, :put, :patch].freeze
|
|
15
15
|
MissingCasterError = Class.new(StandardError)
|
|
16
16
|
|
|
17
|
-
contract(EndpointDto =>
|
|
17
|
+
contract(EndpointDto => PathDto)
|
|
18
18
|
def call(endpoint)
|
|
19
19
|
path_params = []
|
|
20
20
|
|
|
@@ -103,12 +103,15 @@ class ReeSwagger::BuildEndpointSchema
|
|
|
103
103
|
responses: responses
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
method_schema[:summary] = endpoint.summary if endpoint.summary
|
|
107
|
+
method_schema[:description] = endpoint.description if endpoint.description
|
|
108
|
+
|
|
106
109
|
method_schema[:parameters] = parameters if parameters
|
|
107
110
|
method_schema[:requestBody] = request_body if request_body
|
|
108
111
|
|
|
109
112
|
schema = {endpoint.method => method_schema}
|
|
110
113
|
|
|
111
|
-
|
|
114
|
+
PathDto.new(
|
|
112
115
|
path: path,
|
|
113
116
|
schema: schema
|
|
114
117
|
)
|
|
@@ -66,7 +66,8 @@ RSpec.describe :build_endpoint_schema do
|
|
|
66
66
|
caster: caster,
|
|
67
67
|
serializer: serializer,
|
|
68
68
|
response_status: 200,
|
|
69
|
-
description:
|
|
69
|
+
description: "description",
|
|
70
|
+
summary: "summary",
|
|
70
71
|
errors: [
|
|
71
72
|
ReeSwagger::ErrorDto.new(
|
|
72
73
|
status: 400,
|
|
@@ -139,7 +140,9 @@ RSpec.describe :build_endpoint_schema do
|
|
|
139
140
|
401 => {
|
|
140
141
|
description: "- 401 error",
|
|
141
142
|
}
|
|
142
|
-
}
|
|
143
|
+
},
|
|
144
|
+
summary: "summary",
|
|
145
|
+
description: "description",
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
148
|
))
|
|
@@ -165,6 +168,7 @@ RSpec.describe :build_endpoint_schema do
|
|
|
165
168
|
serializer: nil,
|
|
166
169
|
response_status: 200,
|
|
167
170
|
description: nil,
|
|
171
|
+
summary: nil,
|
|
168
172
|
errors: []
|
|
169
173
|
))
|
|
170
174
|
|
|
@@ -224,6 +228,7 @@ RSpec.describe :build_endpoint_schema do
|
|
|
224
228
|
serializer: nil,
|
|
225
229
|
response_status: 200,
|
|
226
230
|
description: nil,
|
|
231
|
+
summary: nil,
|
|
227
232
|
errors: []
|
|
228
233
|
))
|
|
229
234
|
}.to raise_error(
|
|
@@ -245,6 +250,7 @@ RSpec.describe :build_endpoint_schema do
|
|
|
245
250
|
serializer: nil,
|
|
246
251
|
response_status: 200,
|
|
247
252
|
description: nil,
|
|
253
|
+
summary: nil,
|
|
248
254
|
errors: []
|
|
249
255
|
))
|
|
250
256
|
}.to raise_error(
|
data/lib/ree_lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ree_lib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ruslan Gatiyatov
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-08-
|
|
11
|
+
date: 2022-08-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ree
|
|
@@ -164,6 +164,20 @@ dependencies:
|
|
|
164
164
|
- - "~>"
|
|
165
165
|
- !ruby/object:Gem::Version
|
|
166
166
|
version: 0.9.5
|
|
167
|
+
- !ruby/object:Gem::Dependency
|
|
168
|
+
name: rollbar
|
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
|
170
|
+
requirements:
|
|
171
|
+
- - "~>"
|
|
172
|
+
- !ruby/object:Gem::Version
|
|
173
|
+
version: 3.3.1
|
|
174
|
+
type: :development
|
|
175
|
+
prerelease: false
|
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
177
|
+
requirements:
|
|
178
|
+
- - "~>"
|
|
179
|
+
- !ruby/object:Gem::Version
|
|
180
|
+
version: 3.3.1
|
|
167
181
|
description: Ree Lib provides set of packages to extend Ruby Standard Library
|
|
168
182
|
email:
|
|
169
183
|
- ruslan.gatiyatov@gmail.com
|
|
@@ -869,6 +883,7 @@ files:
|
|
|
869
883
|
- lib/ree_lib/packages/ree_logger/package/ree_logger.rb
|
|
870
884
|
- lib/ree_lib/packages/ree_logger/package/ree_logger/appenders/appender.rb
|
|
871
885
|
- lib/ree_lib/packages/ree_logger/package/ree_logger/appenders/file_appender.rb
|
|
886
|
+
- lib/ree_lib/packages/ree_logger/package/ree_logger/appenders/rollbar_appender.rb
|
|
872
887
|
- lib/ree_lib/packages/ree_logger/package/ree_logger/appenders/stdout_appender.rb
|
|
873
888
|
- lib/ree_lib/packages/ree_logger/package/ree_logger/beans/logger.rb
|
|
874
889
|
- lib/ree_lib/packages/ree_logger/package/ree_logger/config.rb
|
|
@@ -887,6 +902,7 @@ files:
|
|
|
887
902
|
- lib/ree_lib/packages/ree_logger/spec/package_schema_spec.rb
|
|
888
903
|
- lib/ree_lib/packages/ree_logger/spec/ree_logger/appenders/appender_spec.rb
|
|
889
904
|
- lib/ree_lib/packages/ree_logger/spec/ree_logger/appenders/file_appender_spec.rb
|
|
905
|
+
- lib/ree_lib/packages/ree_logger/spec/ree_logger/appenders/rollbar_appender_spec.rb
|
|
890
906
|
- lib/ree_lib/packages/ree_logger/spec/ree_logger/appenders/stdout_appender_spec.rb
|
|
891
907
|
- lib/ree_lib/packages/ree_logger/spec/ree_logger/beans/logger_spec.rb
|
|
892
908
|
- lib/ree_lib/packages/ree_logger/spec/ree_logger/formatters/colorized_formatter_spec.rb
|