metova-logger 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/metova/logger/controller_patch.rb +14 -12
- data/lib/metova/logger/railtie.rb +11 -13
- data/lib/metova/logger/version.rb +1 -1
- metadata +1 -2
- data/lib/metova/logger.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4284489f016c362a76d55d9987b136bc55882922
|
4
|
+
data.tar.gz: d274d0521e4ff4042ef655ac4e74f8cf4c944f7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a39ba60372371fc247992108a83fe8df02766137bdba57418a441906643ea44b37e1513ea874cdf481ecf8312baa3728720f370830be779bd00965075fd3783c
|
7
|
+
data.tar.gz: 73f601ab2d47cc6f0918d5c7f7e41ba449c22e2d74e433322ddd684119af401b1325fb07bddfae693c9ea00e32d8a1c6e9de63416fb3764b0f37f2b62e57b766
|
@@ -1,18 +1,20 @@
|
|
1
|
-
module
|
2
|
-
module
|
1
|
+
module Metova
|
2
|
+
module Logger
|
3
|
+
module ControllerPatch
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
def append_info_to_payload(payload)
|
6
|
+
super
|
7
|
+
payload[:ip] = request.remote_ip
|
8
|
+
if current_user
|
9
|
+
payload[:user] = [
|
10
|
+
(current_user.try(:email) || 'NOEMAIL'),
|
11
|
+
current_user.id
|
12
|
+
].join('/')
|
13
|
+
end
|
12
14
|
end
|
13
|
-
end
|
14
15
|
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
|
-
ActionController::Base.send :include,
|
20
|
+
ActionController::Base.send :include, Metova::Logger::ControllerPatch
|
@@ -4,22 +4,20 @@ require 'lograge'
|
|
4
4
|
module Metova
|
5
5
|
module Logger
|
6
6
|
class Railtie < ::Rails::Railtie
|
7
|
-
initializer "metova.logger" do |_|
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
config.lograge.enabled = true
|
14
|
-
config.lograge.custom_options = lambda do |event|
|
15
|
-
{
|
16
|
-
time: event.time,
|
17
|
-
user: event.payload[:user],
|
18
|
-
ip: event.payload[:ip],
|
19
|
-
}
|
20
|
-
end
|
8
|
+
config.log_tags = [
|
9
|
+
lambda { |request| request.uuid[0..15] }
|
10
|
+
]
|
21
11
|
|
12
|
+
config.lograge.enabled = true
|
13
|
+
config.lograge.custom_options = lambda do |event|
|
14
|
+
{
|
15
|
+
time: event.time,
|
16
|
+
user: event.payload[:user],
|
17
|
+
ip: event.payload[:ip],
|
18
|
+
}
|
22
19
|
end
|
20
|
+
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metova-logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Logan Serman
|
@@ -78,7 +78,6 @@ files:
|
|
78
78
|
- LICENSE.txt
|
79
79
|
- README.md
|
80
80
|
- Rakefile
|
81
|
-
- lib/metova/logger.rb
|
82
81
|
- lib/metova/logger/controller_patch.rb
|
83
82
|
- lib/metova/logger/railtie.rb
|
84
83
|
- lib/metova/logger/version.rb
|