sapience 0.1.5 → 0.1.6
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/config/default.yml +0 -1
- data/lib/sapience/sapience.rb +22 -11
- 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: b620c9f4e3bab1dc13730e041f5fb7392b3905c7
|
4
|
+
data.tar.gz: 5b7ea012ee80f8a267e3c57791624afe3ba1f4f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a5ffe52b3de2eef007e81aeac35efaea59e48fe93ad79b6eefc2d7e973bdbcc29683a69440965668493a8451a4495a0dcfd30eea205a048d96a9246db9c29c4
|
7
|
+
data.tar.gz: 3e75783787e99e1c70d5c4540190a4e91fdf8ac907360d8a197a6f64382951ac3f309c4585dadf57157f4d81b936c8a260cab5ddba75b08dd6a71773ffc891d0
|
data/CHANGELOG.md
CHANGED
data/config/default.yml
CHANGED
data/lib/sapience/sapience.rb
CHANGED
@@ -18,10 +18,7 @@ require "socket"
|
|
18
18
|
|
19
19
|
# rubocop:disable ClassVars
|
20
20
|
module Sapience
|
21
|
-
|
22
|
-
# 2. Configure Sapience (Sapience.configure { |c| c.configuration = {} })
|
23
|
-
# 3. Use configuration for rails
|
24
|
-
# 4. Use configuration for grape
|
21
|
+
@@configured = nil
|
25
22
|
|
26
23
|
# Logging levels in order of most detailed to most severe
|
27
24
|
LEVELS = [:trace, :debug, :info, :warn, :error, :fatal]
|
@@ -38,10 +35,15 @@ module Sapience
|
|
38
35
|
end
|
39
36
|
end
|
40
37
|
|
38
|
+
def self.configured?
|
39
|
+
@@configured
|
40
|
+
end
|
41
|
+
|
41
42
|
def self.reset!
|
42
43
|
@@config = nil
|
43
44
|
@@logger = nil
|
44
45
|
@@metrix = nil
|
46
|
+
@@configured = nil
|
45
47
|
reset_appenders!
|
46
48
|
end
|
47
49
|
|
@@ -57,14 +59,11 @@ module Sapience
|
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
|
-
def self.configure
|
62
|
+
def self.configure(force: false)
|
61
63
|
yield config if block_given?
|
62
|
-
|
63
|
-
config.appenders
|
64
|
-
|
65
|
-
add_appender(name, options)
|
66
|
-
end
|
67
|
-
end
|
64
|
+
return config if configured? && force == false
|
65
|
+
add_appenders(*config.appenders)
|
66
|
+
@@configured = true
|
68
67
|
|
69
68
|
config
|
70
69
|
end
|
@@ -166,6 +165,18 @@ module Sapience
|
|
166
165
|
appender
|
167
166
|
end
|
168
167
|
|
168
|
+
# Examples:
|
169
|
+
# Sapience.add_appenders(
|
170
|
+
# { file: { io: STDOUT } },
|
171
|
+
# { sentry: { dsn: "https://app.getsentry.com/" } },
|
172
|
+
# )
|
173
|
+
def self.add_appenders(*appenders)
|
174
|
+
appenders.flatten.compact.each do |appender|
|
175
|
+
appender.each do |name, options|
|
176
|
+
add_appender(name, options)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
169
180
|
|
170
181
|
# Remove an existing appender
|
171
182
|
# Currently only supports appender instances
|
data/lib/sapience/version.rb
CHANGED