sapience 2.5.3 → 2.5.4

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
  SHA1:
3
- metadata.gz: 1b780de6c0e6cd44b9c195665fc83c5fd77ec28c
4
- data.tar.gz: 9d7f2c1e50c99c110f569f1c8b5ba30a1957040c
3
+ metadata.gz: 082583db334e5fff1d6de299a25848c22faa69dd
4
+ data.tar.gz: 8ea9117a75c74bcc52c8e4339576e2fc56d87ffa
5
5
  SHA512:
6
- metadata.gz: 443375f18bd410d190be8c23c5d7a0b07815af6d3fad3bdb127b9310a53204637da67d1fafa139c85b6d4c353a0a5ef518d693b158353542961761471aed7de7
7
- data.tar.gz: 29ff6baac968f8401b7046531e6eff3df847b8c2634d66b5df241897426159f2ace1185a695b2c59447f4957eb5ef869a552a070d9a9cbb6d4d5552ff7a41e75
6
+ metadata.gz: ecf26ed2e95a788a328c40492ef61f0fa81cdb133ae6ba4e5fa2007820f4b574fb687ddc9f173f7eec33055de7877b853e9f6341e5504eadae356da91616745b
7
+ data.tar.gz: 6a085768d78deeb6495d70a0602c22f1ed8e9f6da7ae6f70539cbd35c6761e54db1de7f46ade23892ad2bfa3c2bd1c2f43952aca3daf919e34a45a37e2dbdc18
@@ -1,6 +1,10 @@
1
+ ## v2.5.4
2
+
3
+ - Add compatibility fix for concurrent-ruby library logger which expect `call` method to be defined
4
+
1
5
  ## v2.5.3
2
6
 
3
- - Fix issues after applying fronzen_string_literal = true. Make it compatible to Ruby 2.1
7
+ - Fix issues after applying fronzen_string_literal = true. Make it compatible to Ruby 2.1
4
8
 
5
9
  ## v2.5.2
6
10
 
@@ -21,7 +25,7 @@
21
25
 
22
26
  ## v2.3.5
23
27
 
24
- - Set Sapience.config.app_name when APP_NAME environment variable is set
28
+ - Set Sapience.config.app_name when APP_NAME environment variable is set
25
29
 
26
30
  ## v2.3.3
27
31
 
@@ -39,8 +43,8 @@
39
43
 
40
44
  ## v2.2.3
41
45
 
42
- - Set immediate_executor by default to avoid Errno::EIO error for multithreaded processes.
43
- This could happen when orphaned process (whose parent has died) attempts to get stdio from parent process,
46
+ - Set immediate_executor by default to avoid Errno::EIO error for multithreaded processes.
47
+ This could happen when orphaned process (whose parent has died) attempts to get stdio from parent process,
44
48
  or when stream is closed.
45
49
 
46
50
  ## v2.2.1
@@ -107,7 +111,7 @@
107
111
 
108
112
  ## v1.0.10
109
113
 
110
- - Automatically add default `datadog` appender when calling `Sapience.metrics`
114
+ - Automatically add default `datadog` appender when calling `Sapience.metrics`
111
115
 
112
116
  ## v1.0.9
113
117
 
data/README.md CHANGED
@@ -13,16 +13,17 @@ This project aims to make it easier to centralise the configuration of these thr
13
13
  We have taken a great deal of inspiration from the amazing [Semantic Logger](https://github.com/rocketjob/semantic_logger) and implemented something similar to [Rubocop](https://github.com/bbatsov/rubocop) for handling and overriding how to find configuration. If you want some inspiration for how we do something similar for our projects for Rubocop check: [Reevoocop](https://github.com/reevoo/reevoocop).
14
14
 
15
15
  ## Installation
16
-
17
- First of all we need to require the right file for the project. There are currently two frameworks supported (rails and grape).
16
+ sapience-rb integrates with rails, grape or can be used standalone.
18
17
 
19
18
  ### Rails
19
+ Add the gem:
20
20
 
21
21
  ```ruby
22
22
  gem "sapience", require: "sapience/rails"
23
23
  ```
24
24
 
25
25
  ### Grape
26
+ Add the gem:
26
27
 
27
28
  ```ruby
28
29
  gem "sapience", require: "sapience/grape"
@@ -91,6 +92,24 @@ API.logger = Sapience.logger
91
92
  **Note**: If you're using the rackup command to run your server in development, pass the -q flag to silence the default
92
93
  rack logger so you don't get double logging.
93
94
 
95
+ ### Standalone
96
+ Add the gem:
97
+
98
+ ```ruby
99
+ gem "sapience"
100
+ ```
101
+
102
+ Somewhere early in your code execute the following:
103
+ ```ruby
104
+ require "sapience"
105
+
106
+ Sapience.configure do |config|
107
+ config.app_name = "My Application"
108
+ end
109
+ ```
110
+ This will apply the default configuration. See section [Configuration](#configuration) for instructions on
111
+ how to configure the library according to your needs.
112
+
94
113
 
95
114
  ## Configuration
96
115
 
@@ -98,7 +117,11 @@ The sapience configuration can be controlled by either a "sapience.yml" file, or
98
117
 
99
118
  #### Configuration by sapience.yml file
100
119
 
101
- Add a `config/sapience.yml` file to you appplication. Or if you, like us, have many projects that use the same configuration you can create your own gem with a shared .yml config. Have a look at [reevoo/reevoo_sapience-rb](https://github.com/reevoo/reevoo_sapience-rb) for an example . See below an example of how to configure "sapience.yml":
120
+ Add a `config/sapience.yml` file to your application. The config file contains sections for different environments.
121
+ When using with rails or grape the environment will be set by the framework. When using as standalone, use ENV
122
+ variable `SAPIENCE_ENV` for setting the environment.
123
+
124
+ Or if you, like us, have many projects that use the same configuration you can create your own gem with a shared .yml config. Have a look at [reevoo/reevoo_sapience-rb](https://github.com/reevoo/reevoo_sapience-rb) for an example . See below an example of how to configure "sapience.yml":
102
125
 
103
126
  ```yaml
104
127
  default:
@@ -186,7 +209,7 @@ You need to create the test postgres db, by running the command below:
186
209
 
187
210
  `createdb rails_app_test`
188
211
 
189
- Then you can run them with the followign command:
212
+ Then you can run them with the following command:
190
213
 
191
214
  `bin/tests`
192
215
 
@@ -1,7 +1,4 @@
1
1
  version: '2'
2
- volumes:
3
- gems:
4
- driver: local
5
2
 
6
3
  services:
7
4
  rabbitmq:
@@ -34,8 +31,6 @@ services:
34
31
  # Mount our app code directory (".") into our app containers at the
35
32
  # "/usr/src/app" folder:
36
33
  - .:/usr/src/app
37
- # Mount the 'gems' volume on the folder that stores bundled gems:
38
- - gems:/usr/local/bundle
39
34
 
40
35
 
41
36
 
@@ -0,0 +1,17 @@
1
+ # Sapience::Loggers::Concurrent is a class wrapping all methods necessary for integration with concurrent-ruby gem .
2
+ module Sapience
3
+ module Loggers
4
+ class Concurrent < Sapience::Logger
5
+
6
+ def initialize(level = nil, filter = nil)
7
+ super("Concurrent", level, filter)
8
+ end
9
+
10
+ # *call* method is expected to be defined for all Concurrent.global_logger instances
11
+ # see https://github.com/ruby-concurrency/concurrent-ruby/blob/master/lib/concurrent/concern/logging.rb#L25
12
+ def call(level, progname, message, &block)
13
+ log(level, message, progname, &block)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -13,6 +13,7 @@ require "sapience/extensions/active_job/notifications" if defined?(ActiveJob)
13
13
  require "sapience/extensions/rails/rack/logger"
14
14
  require "sapience/extensions/rails/rack/logger_info_as_debug"
15
15
  require "sapience/extensions/action_view/log_subscriber"
16
+ require "sapience/loggers/concurrent"
16
17
 
17
18
  module Sapience
18
19
  module Rails
@@ -58,7 +59,7 @@ module Sapience
58
59
  Bugsnag.configure { |config| config.logger = Sapience[Bugsnag] } if defined?(Bugsnag)
59
60
 
60
61
  # Set the logger for concurrent-ruby
61
- Concurrent.global_logger = Sapience[Concurrent] if defined?(Concurrent)
62
+ Concurrent.global_logger = Sapience::Loggers::Concurrent.new if defined?(Concurrent)
62
63
  end
63
64
 
64
65
  # Before any initializers run, but after the gems have been loaded
@@ -91,7 +91,6 @@ module Sapience
91
91
  @@appenders = Concurrent::Array.new
92
92
  end
93
93
 
94
- # TODO: Default to SAPIENCE_ENV (if present it should be returned first)
95
94
  def self.environment
96
95
  @@environment ||=
97
96
  ENV.fetch(SAPIENCE_ENV) do
@@ -100,7 +99,6 @@ module Sapience
100
99
  if defined?(::Rails) && ::Rails.respond_to?(:env)
101
100
  ::Rails.env
102
101
  else
103
- warn "Sapience is going to use default configuration"
104
102
  DEFAULT_ENV
105
103
  end
106
104
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Sapience
3
- VERSION = "2.5.3"
3
+ VERSION = "2.5.4"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sapience
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-20 00:00:00.000000000 Z
12
+ date: 2018-09-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: concurrent-ruby
@@ -368,6 +368,7 @@ files:
368
368
  - lib/sapience/log_methods.rb
369
369
  - lib/sapience/loggable.rb
370
370
  - lib/sapience/logger.rb
371
+ - lib/sapience/loggers/concurrent.rb
371
372
  - lib/sapience/metrics.rb
372
373
  - lib/sapience/metrics/datadog.rb
373
374
  - lib/sapience/rails.rb