sapience 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sapience/appender/sentry.rb +5 -4
- data/lib/sapience/sapience.rb +9 -8
- data/lib/sapience/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3967a4729eeba64c34677f98a849602f5fd986fe
|
4
|
+
data.tar.gz: de551242cfbacd423e53b933647858f235ae205d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d84f5cad6e1688ba5036b1df539e74a63b2d5548a1b80bae6ffefa8f743824d293c1ecd0fad522e321675237ace46ff4e034a054e95009fc1ea223fdf1b385b
|
7
|
+
data.tar.gz: 69f34cd2f76e8f8fe161a8536b35c1b82bc055b6d43a4fe106b49acccdc9c342820c75bec17c48af8043009357f34e7902c92be7fdcda8f8ae7b7099bda1e26a
|
data/CHANGELOG.md
CHANGED
@@ -43,16 +43,17 @@ module Sapience
|
|
43
43
|
|
44
44
|
options[:level] ||= :error
|
45
45
|
Raven.configure do |config|
|
46
|
-
config.dsn
|
46
|
+
config.dsn = options.delete(:dsn)
|
47
|
+
config.tags = { environment: Sapience.environment }
|
47
48
|
end
|
49
|
+
|
48
50
|
super(options, &block)
|
49
51
|
end
|
50
52
|
|
51
53
|
def validate_options!(options = {})
|
52
54
|
fail ArgumentError, "Options should be a Hash" unless options.is_a?(Hash)
|
53
|
-
|
54
|
-
|
55
|
-
fail ArgumentError, "The :dsn key is not a valid URI" unless dsn_valid
|
55
|
+
dsn_valid = options[:dsn].to_s =~ URI::DEFAULT_PARSER.regexp[:ABS_URI]
|
56
|
+
fail ArgumentError, "The :dsn key (#{options[:dsn]}) is not a valid URI" unless dsn_valid
|
56
57
|
end
|
57
58
|
|
58
59
|
# Send an error notification to sentry
|
data/lib/sapience/sapience.rb
CHANGED
@@ -21,17 +21,13 @@ module Sapience
|
|
21
21
|
@@configured = nil
|
22
22
|
|
23
23
|
# Logging levels in order of most detailed to most severe
|
24
|
-
LEVELS = [:trace, :debug, :info, :warn, :error, :fatal]
|
24
|
+
LEVELS = [:trace, :debug, :info, :warn, :error, :fatal].freeze
|
25
|
+
DEFAULT_ENV = "default".freeze
|
25
26
|
|
26
27
|
def self.config
|
27
28
|
@@config ||= begin
|
28
29
|
config = ConfigLoader.load_from_file
|
29
|
-
|
30
|
-
unless env
|
31
|
-
puts "Missing configuration for #{environment} environment. Sapience is going to use default configuration"
|
32
|
-
env = config.fetch("default")
|
33
|
-
end
|
34
|
-
Configuration.new(env)
|
30
|
+
Configuration.new(config[environment])
|
35
31
|
end
|
36
32
|
end
|
37
33
|
|
@@ -54,7 +50,12 @@ module Sapience
|
|
54
50
|
def self.environment
|
55
51
|
ENV.fetch("RAILS_ENV") do
|
56
52
|
ENV.fetch("RACK_ENV") do
|
57
|
-
|
53
|
+
if defined?(::Rails) && ::Rails.respond_to?(:env)
|
54
|
+
::Rails.env
|
55
|
+
else
|
56
|
+
puts "Sapience is going to use default configuration"
|
57
|
+
DEFAULT_ENV
|
58
|
+
end
|
58
59
|
end
|
59
60
|
end
|
60
61
|
end
|
data/lib/sapience/version.rb
CHANGED