strum-logs 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a86bb6402b0483eef5de270bcf4ce902f882cfb3a8c145f2649d15f0c9adcb5f
4
+ data.tar.gz: 1552495db0a23e380fa1e3b54f96a1bd2658aba1299eda5ab25f74a34a906e07
5
+ SHA512:
6
+ metadata.gz: 7e51a2a5e60223c19d2c72d4ff65752f21b33e4f1ccc04b1d92008ab2b61025681094f761e850232709db2747fef81d172cd5ff9a6c8ecbec2d52904fdaea1c4
7
+ data.tar.gz: c6670771c933affe440265ebb76a8340a31967e96abfbf2093b4804f6ccaf378326065ad64699e2561e7976e1c6f799cf6ba389202a526c0744bbd39dcd61cf1
data/.editorconfig ADDED
@@ -0,0 +1,8 @@
1
+ [*]
2
+
3
+ indent_style = space
4
+ indent_size = 2
5
+ end_of_line = lf
6
+ charset = utf-8
7
+ trim_trailing_whitespace = true
8
+ insert_final_newline = true
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # Editor directories and files
14
+ .idea
15
+ .vscode
16
+ *.suo
17
+ *.ntvs*
18
+ *.njsproj
19
+ *.sln
20
+ *.sw*
21
+
22
+ # builds
23
+ strum-logs-*.gem
data/.gitlab-ci.yml ADDED
@@ -0,0 +1,3 @@
1
+ include:
2
+ - project: 'strum-rb/ci-cd'
3
+ file: '/strum-rb/.gitlab-ci.yml'
data/.rubocop.yml ADDED
@@ -0,0 +1,52 @@
1
+ # require: rubocop-rspec
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.7.0
5
+
6
+ # additional excludes for Rails
7
+ Exclude:
8
+ - 'config/**/*'
9
+ - 'spec/**/**/*'
10
+
11
+ Lint/RaiseException:
12
+ Enabled: true
13
+
14
+ Lint/StructNewOverride:
15
+ Enabled: true
16
+
17
+ Style/HashEachMethods:
18
+ Enabled: true
19
+
20
+ Style/DoubleNegation:
21
+ Enabled: false
22
+
23
+ Style/HashTransformKeys:
24
+ Enabled: true
25
+
26
+ Style/HashTransformValues:
27
+ Enabled: true
28
+
29
+ Layout/LineLength:
30
+ Max: 130
31
+ IgnoredPatterns: ['\A#']
32
+
33
+ Metrics/MethodLength:
34
+ Max: 20
35
+
36
+ Metrics/AbcSize:
37
+ Max: 15
38
+
39
+ Metrics/ClassLength:
40
+ Max: 120
41
+
42
+ Metrics/BlockLength:
43
+ Max: 30
44
+
45
+ Layout/SpaceInLambdaLiteral:
46
+ EnforcedStyle: require_space
47
+
48
+ Style/StringLiterals:
49
+ EnforcedStyle: double_quotes
50
+
51
+ Style/Documentation:
52
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-07-28
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at sn@nazarov.com.ua. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rake", "~> 12.3"
6
+
7
+ gem "minitest", "~> 5.0"
8
+
9
+ gem "rubocop", "~> 1.21"
10
+
11
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
12
+
13
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,177 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ strum-logs (1.0.0)
5
+ amazing_print (~> 1.4)
6
+ dry-configurable (~> 0.12.1)
7
+ opentelemetry-common (~> 0.19)
8
+ opentelemetry-exporter-otlp (~> 0.22)
9
+ opentelemetry-instrumentation-bunny (~> 0.19)
10
+ opentelemetry-instrumentation-faraday (~> 0.21)
11
+ opentelemetry-instrumentation-pg (~> 0.21)
12
+ opentelemetry-instrumentation-rack (~> 0.21)
13
+ opentelemetry-instrumentation-redis (~> 0.23)
14
+ opentelemetry-instrumentation-sinatra (~> 0.20)
15
+ opentelemetry-sdk (~> 1.1)
16
+ ougai (~> 2.0)
17
+ rack (~> 2.2.4)
18
+ redis
19
+ sequel (~> 5.24)
20
+
21
+ GEM
22
+ remote: https://rubygems.org/
23
+ specs:
24
+ amazing_print (1.4.0)
25
+ amq-protocol (2.3.2)
26
+ ast (2.4.2)
27
+ bunny (2.19.0)
28
+ amq-protocol (~> 2.3, >= 2.3.1)
29
+ sorted_set (~> 1, >= 1.0.2)
30
+ concurrent-ruby (1.1.10)
31
+ connection_pool (2.2.5)
32
+ dry-configurable (0.12.1)
33
+ concurrent-ruby (~> 1.0)
34
+ dry-core (~> 0.5, >= 0.5.0)
35
+ dry-core (0.8.1)
36
+ concurrent-ruby (~> 1.0)
37
+ dry-inflector (0.2.1)
38
+ faraday (1.10.0)
39
+ faraday-em_http (~> 1.0)
40
+ faraday-em_synchrony (~> 1.0)
41
+ faraday-excon (~> 1.1)
42
+ faraday-httpclient (~> 1.0)
43
+ faraday-multipart (~> 1.0)
44
+ faraday-net_http (~> 1.0)
45
+ faraday-net_http_persistent (~> 1.0)
46
+ faraday-patron (~> 1.0)
47
+ faraday-rack (~> 1.0)
48
+ faraday-retry (~> 1.0)
49
+ ruby2_keywords (>= 0.0.4)
50
+ faraday-em_http (1.0.0)
51
+ faraday-em_synchrony (1.0.0)
52
+ faraday-excon (1.1.0)
53
+ faraday-httpclient (1.0.1)
54
+ faraday-multipart (1.0.4)
55
+ multipart-post (~> 2)
56
+ faraday-net_http (1.0.1)
57
+ faraday-net_http_persistent (1.2.0)
58
+ faraday-patron (1.0.0)
59
+ faraday-rack (1.0.0)
60
+ faraday-retry (1.0.3)
61
+ faraday_middleware (1.2.0)
62
+ faraday (~> 1.0)
63
+ google-protobuf (3.21.4)
64
+ googleapis-common-protos-types (1.3.2)
65
+ google-protobuf (~> 3.14)
66
+ json (2.6.2)
67
+ minitest (5.16.2)
68
+ multipart-post (2.2.3)
69
+ oj (3.13.19)
70
+ opentelemetry-api (1.0.2)
71
+ opentelemetry-common (0.19.6)
72
+ opentelemetry-api (~> 1.0)
73
+ opentelemetry-exporter-otlp (0.23.0)
74
+ google-protobuf (~> 3.19)
75
+ googleapis-common-protos-types (~> 1.3)
76
+ opentelemetry-api (~> 1.0)
77
+ opentelemetry-common (~> 0.19.6)
78
+ opentelemetry-sdk (~> 1.0)
79
+ opentelemetry-semantic_conventions
80
+ opentelemetry-instrumentation-base (0.21.0)
81
+ opentelemetry-api (~> 1.0)
82
+ opentelemetry-registry (~> 0.1)
83
+ opentelemetry-instrumentation-bunny (0.19.0)
84
+ opentelemetry-api (~> 1.0)
85
+ opentelemetry-instrumentation-base (~> 0.21.0)
86
+ opentelemetry-instrumentation-faraday (0.21.0)
87
+ opentelemetry-api (~> 1.0)
88
+ opentelemetry-common (~> 0.19.3)
89
+ opentelemetry-instrumentation-base (~> 0.21.0)
90
+ opentelemetry-instrumentation-pg (0.21.0)
91
+ opentelemetry-api (~> 1.0)
92
+ opentelemetry-instrumentation-base (~> 0.21.0)
93
+ opentelemetry-instrumentation-rack (0.21.0)
94
+ opentelemetry-api (~> 1.0)
95
+ opentelemetry-common (~> 0.19.3)
96
+ opentelemetry-instrumentation-base (~> 0.21.0)
97
+ opentelemetry-instrumentation-redis (0.23.0)
98
+ opentelemetry-api (~> 1.0)
99
+ opentelemetry-common (~> 0.19.3)
100
+ opentelemetry-instrumentation-base (~> 0.21.0)
101
+ opentelemetry-instrumentation-sinatra (0.20.0)
102
+ opentelemetry-api (~> 1.0)
103
+ opentelemetry-common (~> 0.19.3)
104
+ opentelemetry-instrumentation-base (~> 0.21.0)
105
+ opentelemetry-registry (0.1.0)
106
+ opentelemetry-api (~> 1.0.1)
107
+ opentelemetry-sdk (1.1.0)
108
+ opentelemetry-api (~> 1.0)
109
+ opentelemetry-common (~> 0.19.3)
110
+ opentelemetry-registry (~> 0.1)
111
+ opentelemetry-semantic_conventions
112
+ opentelemetry-semantic_conventions (1.8.0)
113
+ opentelemetry-api (~> 1.0)
114
+ ougai (2.0.0)
115
+ oj (~> 3.10)
116
+ parallel (1.22.1)
117
+ parser (3.1.2.0)
118
+ ast (~> 2.4.1)
119
+ rack (2.2.4)
120
+ rainbow (3.1.1)
121
+ rake (12.3.3)
122
+ rbtree (0.4.5)
123
+ redis (4.7.1)
124
+ regexp_parser (2.5.0)
125
+ rexml (3.2.5)
126
+ rubocop (1.33.0)
127
+ json (~> 2.3)
128
+ parallel (~> 1.10)
129
+ parser (>= 3.1.0.0)
130
+ rainbow (>= 2.2.2, < 4.0)
131
+ regexp_parser (>= 1.8, < 3.0)
132
+ rexml (>= 3.2.5, < 4.0)
133
+ rubocop-ast (>= 1.19.1, < 2.0)
134
+ ruby-progressbar (~> 1.7)
135
+ unicode-display_width (>= 1.4.0, < 3.0)
136
+ rubocop-ast (1.19.1)
137
+ parser (>= 3.1.1.0)
138
+ ruby-progressbar (1.11.0)
139
+ ruby2_keywords (0.0.5)
140
+ sequel (5.59.0)
141
+ serverengine (2.1.1)
142
+ sigdump (~> 0.2.2)
143
+ set (1.0.2)
144
+ sigdump (0.2.4)
145
+ sneakers (2.12.0)
146
+ bunny (~> 2.14)
147
+ concurrent-ruby (~> 1.0)
148
+ rake (~> 12.3)
149
+ serverengine (~> 2.1.0)
150
+ thor
151
+ sorted_set (1.0.3)
152
+ rbtree
153
+ set (~> 1.0)
154
+ strum-esb (0.3.3)
155
+ bunny (~> 2.15)
156
+ connection_pool (~> 2.2.2)
157
+ dry-configurable (~> 0.12.1)
158
+ dry-inflector (~> 0.2.1)
159
+ json (~> 2.3)
160
+ sneakers (~> 2.12)
161
+ thor (1.2.1)
162
+ unicode-display_width (2.2.0)
163
+
164
+ PLATFORMS
165
+ ruby
166
+
167
+ DEPENDENCIES
168
+ faraday (~> 1.10.0)
169
+ faraday_middleware (~> 1.2.0)
170
+ minitest (~> 5.0)
171
+ rake (~> 12.3)
172
+ rubocop (~> 1.21)
173
+ strum-esb
174
+ strum-logs!
175
+
176
+ BUNDLED WITH
177
+ 2.3.18
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Serhiy Nazarov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,189 @@
1
+ # Strum::Logs
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/strum/logs`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'strum-logs'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install strum-logs
22
+
23
+ ## Usage
24
+
25
+ In order to start working with this gem, following configuration must be enabled:
26
+
27
+ ```
28
+ StrumLogs::Configuration.configure do |config|
29
+ config.application_version = "1.0.0"
30
+ config.application_name = "app name"
31
+ config.redis_instrumentation = true
32
+ config.rack_instrumentation = true
33
+ config.environment = "development"
34
+ end
35
+ ```
36
+
37
+ This configuration allows to use rack and redis open telemetry tracing.
38
+ Redis logger can be enabled using following configuration:
39
+ ```
40
+ StrumLogs::Configuration.configure do |config|
41
+ config.redis_after_call_hooks = [StrumLogs::Redis::Logger.new]
42
+ end
43
+ ```
44
+ Example of redis logs:
45
+ ```
46
+ {
47
+ :request => "get hello",
48
+ :message => "redis request",
49
+ :response_message => "world",
50
+ :service_name => "app name",
51
+ :version => "1.0.0",
52
+ :trace_id => "0973f2d0c2f92ce3b29e41638d09bc89",
53
+ :span_id => "37fc1030e7b8413c"
54
+ }
55
+ ```
56
+ Rack logging can be enabled as rack middleware:
57
+
58
+ ```
59
+ require 'roda'
60
+ require 'strum_logs'
61
+
62
+ class AppName < Roda
63
+ use StrumLogs::Rack::RequestLogMiddleware
64
+ ```
65
+
66
+ Example of rack logs:
67
+ ```
68
+ {
69
+ :method => "GET",
70
+ :path => "/wp-debts/info",
71
+ :query => "",
72
+ :protocol => "HTTP/1.1",
73
+ :started_at => 2022-08-02 11:04:15.588912879 +0300,
74
+ :peer => "127.0.0.1",
75
+ :message => "HTTP Request",
76
+ :user => nil,
77
+ :status => 200,
78
+ :headers => {
79
+ "Content-Type" => "application/vnd.api+json",
80
+ "Content-Length" => "20",
81
+ "traceparent" => "00-0973f2d0c2f92ce3b29e41638d09bc89-37fc1030e7b8413c-01"
82
+ },
83
+ :response_message => "{\"data\":[],\"meta\":0}",
84
+ :log_status => "success",
85
+ :request => nil,
86
+ :finished => 2022-08-02 11:04:17.549062761 +0300,
87
+ :elapsed_ms => 1960.1499,
88
+ :service_name => "app name",
89
+ :version => "1.0.0",
90
+ :trace_id => "0973f2d0c2f92ce3b29e41638d09bc89",
91
+ :span_id => "37fc1030e7b8413c"
92
+ }
93
+ ```
94
+ Faraday logs can be enabled by using Faraday middleware:
95
+ ```
96
+ require 'strum_logs'
97
+ conn = Faraday.new(url: https://example.com/, headers: {}) do |c|
98
+ c.use StrumLogs::Faraday::RequestLogMiddleware
99
+ end
100
+ ```
101
+ To enable faraday open telemetry tracing, following config should be enabled:
102
+ ```
103
+ StrumLogs::Configuration.configure do |config|
104
+ config.faraday_instrumentation = true
105
+ end
106
+ ```
107
+ To enable strum esb logs, following configuration must be added to strum esb configs:
108
+ ```
109
+ Strum::Esb.configure do |config|
110
+ config.before_publish_hooks = [StrumLogs::StrumEsbHooks.method(:before_publish_hook)]
111
+ config.before_handler_hooks = [StrumLogs::StrumEsbHooks.method(:before_handler_hook)]
112
+ config.after_handler_hooks = [StrumLogs::StrumEsbHooks.method(:after_handler_hook)]
113
+ end
114
+ ```
115
+ Strum esb logs example:
116
+ ```
117
+ {
118
+ :message => "Handling AMQP message",
119
+ :body => "{ \"hello\": \"world\" }",
120
+ :properties => {
121
+ :consumer_tag => "bunny-1659424153000-768018451868",
122
+ :delivery_tag => #<Bunny::VersionedDeliveryTag:0x0000558005b4edf0 @tag=1, @version=0>,
123
+ :redelivered => false,
124
+ :exchange => "",
125
+ :routing_key => "test_hooks",
126
+ :consumer => #<Bunny::Consumer:9180 @channel_id=1 @queue=test_hooks> @consumer_tag=bunny-1659424153000-768018451868 @exclusive= @no_ack=false>,
127
+ :channel => #<Bunny::Channel:9200 @id=1 @connection=#<Bunny::Session:0x4628 guest@rabbit.lvh.me:5672, vhost=/, addresses=[rabbit.lvh.me:5672]>> @open=true
128
+ },
129
+ :protocol => "AMQP",
130
+ :metadata => {
131
+ :headers => {
132
+ "action" => "test",
133
+ "resource" => "hello"
134
+ },
135
+ :delivery_mode => 1
136
+ },
137
+ :service_name => "working permits debts",
138
+ :version => "1.0.1",
139
+ :trace_id => "00000000000000000000000000000000",
140
+ :span_id => "0000000000000000"
141
+ }
142
+
143
+ ```
144
+ To use rabbit open telemetry traces, following configuration should be set:
145
+ ```
146
+ StrumLogs::Configuration.configure do |config|
147
+ config.rabbit_instrumentation = true
148
+ end
149
+ ```
150
+ To use sequel logger, strum logger should be added to sequel loggers:
151
+ ```
152
+ DB.logger = StrumLogs::Sequel::Logger.new
153
+ ```
154
+ ## Configuration options
155
+ Gem has a number of configuration options. Note, that some of them are required to be specified in order for gem to be working
156
+
157
+ ```
158
+ StrumLogs::Configuration.configure do |config|
159
+ config.stdout_sync = true # Sets std_out_sync to true, true by default
160
+ config.level = Logger::INFO # Sets log level, info by default
161
+ config.application_version = "1.0.0" # Sets app version, mandatory configuration
162
+ config.application_name = "app name" # Sets app name, mandatory field
163
+ config.redis_instrumentation = false # Turns on redis logger and open telemetry tracing for redis, false by default
164
+ config.rack_instrumentation = false # Turns on rack open telemetry traces, false by default
165
+ config.faraday_instrumentation = true # Turns on faraday open telemetry traces, false by default
166
+ config.rabbit_instrumentation = true # Turns on bunny open telemetry traces, false by default
167
+ config.stack_trace = true # Turns on error stack trace field, true by default
168
+ config.environment = ENV["RACK_ENV"] # Is set by RACK_ENV environmental variable, development by default
169
+ config.enable_export_spans = false # Span export, false by default
170
+ config.redis_after_call_hooks = [] # Is used to add hooks after redis call (currently is used to add log hook)
171
+ end
172
+ ```
173
+ ## Development
174
+
175
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
176
+
177
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
178
+
179
+ ## Contributing
180
+
181
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/strum-logs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/strum-logs/blob/master/CODE_OF_CONDUCT.md).
182
+
183
+ ## License
184
+
185
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
186
+
187
+ ## Code of Conduct
188
+
189
+ Everyone interacting in the Strum::Logs project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/strum-logs/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "minitest/test_task"
5
+
6
+ Minitest::TestTask.create(:test) do |t|
7
+ t.libs << "spec"
8
+ t.warning = false
9
+ t.test_globs = ["spec/**/*_spec.rb"]
10
+ end
11
+
12
+ task default: :test
data/bin/console.rb ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
4
+ require "strum/logs"
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(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Strum
4
+ module Logs
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
data/lib/strum/logs.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "logs/version"
4
+
5
+ module Strum
6
+ module Logs
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry-configurable"
4
+ require "ougai"
5
+ require "strum_logs/errors/configuration_error"
6
+
7
+ module StrumLogs
8
+ module Configuration
9
+ SUCCESSFUL_STATUSES = (200..299).freeze
10
+
11
+ extend Dry::Configurable
12
+
13
+ setting(:application_version, "app name") { |value| value }
14
+ setting(:application_name, "1.0.0") { |value| value }
15
+ setting(:level, Logger::INFO) { |value| value }
16
+ setting(:stdout_sync, true) { |value| value }
17
+ setting(:pg_instrumentation, false) { |value| value }
18
+ setting(:redis_instrumentation, false) { |value| value }
19
+ setting(:enable_export_spans, false) { |value| value }
20
+ setting(:environment) { |_value| ENV["RACK_ENV"] || "development" }
21
+ setting(:stack_trace, true) { |value| value }
22
+ setting(:rack_instrumentation, false) { |value| value }
23
+ setting(:faraday_instrumentation, false) { |value| value }
24
+ setting(:rabbit_instrumentation, false) { |value| value }
25
+ setting(:redis_after_call_hooks, []) { |value| value }
26
+ end
27
+ end