prosopite 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1af17b69a330a3d3f6671044a52767af5f93c6245c24f8f690320bf70b863b5f
4
- data.tar.gz: 3abb664fad375de93c92f909e42bcc68d89287271b9be57d85a1c1f9cb561cba
3
+ metadata.gz: dc0695c895e2f636c3c2a2caa2c4b211cad0f7d57f8bd4842fbc534ba9e55190
4
+ data.tar.gz: 2dcd4426e5b792a58cee89ec601e3388bacc97cb0de57aa3b87dd7600dd6b020
5
5
  SHA512:
6
- metadata.gz: acdecfb19aff6229c9ec15dd62794b786caf21e30a96d5c8a0038412b1805938217f70380d7501054721f8a716ff40c883b12d21e888befcf434f6a503d2cf99
7
- data.tar.gz: 5d71d8b945b92e3db0a3f9993217ab85a363b5e259134f95be03bb214e8ffdb9bd9e814983104571e698dcb1863f9bb9e3ec89bf0246ebdfbc8d15c75fa9a3b9
6
+ metadata.gz: b2c1c6a4723c44c24ab800fede6c14d49f74ba1c97c4aa60c59a231725e001ca45416abb878331157402582114e144931e39774a9af51fb422d12ba4f668403b
7
+ data.tar.gz: 2175b7c1bd661c5bca41c1263e9a750d63b205e548ef1d2f13ca2aac43c6306eaad3e3bb8420e627ab2576821565311c525e6b51576b4e30431c41420b3b7f0b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prosopite (1.0.8)
4
+ prosopite (1.0.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -115,10 +115,34 @@ Or install it yourself as:
115
115
 
116
116
  The preferred type of notifications can be configured with:
117
117
 
118
+ * `Prosopite.raise = true`: Raise warnings as exceptions
118
119
  * `Prosopite.rails_logger = true`: Send warnings to the Rails log
119
120
  * `Prosopite.prosopite_logger = true`: Send warnings to `log/prosopite.log`
120
121
  * `Prosopite.stderr_logger = true`: Send warnings to STDERR
121
- * `Prosopite.raise = true`: Raise warnings as exceptions
122
+ * `Prosopite.custom_logger = my_custom_logger`:
123
+
124
+ ### Custom Logging Configuration
125
+
126
+ You can supply a custom logger with the `Prosopite.custom_logger` setting.
127
+
128
+ This is useful for circumstances where you don't want your logs to be
129
+ highlighted with red, or you want logs sent to a custom location.
130
+
131
+ One common scenario is that you may be generating json logs and sending them to
132
+ Datadog, ELK stack, or similar, and don't want to have to remove the default red
133
+ escaping data from messages sent to the Rails logger, or want to tag them
134
+ differently with your own custom logger.
135
+
136
+ ```ruby
137
+ # Turns off logging with red highlights, but still sends them to the Rails logger
138
+ Prosopite.custom_logger = Rails.logger
139
+ ```
140
+
141
+ ```ruby
142
+ # Use a completely custom logging instance
143
+ Prosopite.custom_logger = MyLoggerClass.new
144
+
145
+ ```
122
146
 
123
147
  ## Development Environment Usage
124
148
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Prosopite
4
- VERSION = "1.0.8"
4
+ VERSION = "1.0.9"
5
5
  end
data/lib/prosopite.rb CHANGED
@@ -8,6 +8,7 @@ module Prosopite
8
8
  :stderr_logger,
9
9
  :rails_logger,
10
10
  :prosopite_logger,
11
+ :custom_logger,
11
12
  :allow_stack_paths,
12
13
  :ignore_queries
13
14
 
@@ -155,6 +156,7 @@ module Prosopite
155
156
  end
156
157
 
157
158
  def send_notifications
159
+ @custom_logger ||= false
158
160
  @rails_logger ||= false
159
161
  @stderr_logger ||= false
160
162
  @prosopite_logger ||= false
@@ -172,6 +174,8 @@ module Prosopite
172
174
  notifications_str << "\n"
173
175
  end
174
176
 
177
+ @custom_logger.warn(notifications_str) if @custom_logger
178
+
175
179
  Rails.logger.warn(red(notifications_str)) if @rails_logger
176
180
  $stderr.puts(red(notifications_str)) if @stderr_logger
177
181
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prosopite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mpampis Kostas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-25 00:00:00.000000000 Z
11
+ date: 2022-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry