effective_logging 1.10.3 → 1.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective_logger.rb +18 -19
- data/lib/effective_logging/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d567d6badd11813f0275b72ada91d72306ca5a2
|
4
|
+
data.tar.gz: c0b753689f05b4140d0ae6c961e7f497bc5bc09e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adbbd2194efad68de68495fbaf513826daf0287102f4de0db0383a434348559c4d34271d09d4f336f7ea4bab1d7d2f152c5653788ffb9bc76e9d3f9bc6ecd9c6
|
7
|
+
data.tar.gz: ce68767bd2e1a015cd8860ddb4cc86f4e6b4e061140e077d2dc62cde691550410fff21f534051b7bb35eb23f38893e6743790c72ecbc11a01301766f56479472
|
@@ -3,35 +3,34 @@
|
|
3
3
|
class EffectiveLogger
|
4
4
|
def self.log(message, status = EffectiveLogging.statuses.first, options = {})
|
5
5
|
if options[:user].present? && !options[:user].kind_of?(User)
|
6
|
-
raise ArgumentError.new(
|
6
|
+
raise ArgumentError.new('Log.log :user => ... argument must be a User object')
|
7
7
|
end
|
8
8
|
|
9
9
|
if options[:parent].present? && !options[:parent].kind_of?(Effective::Log)
|
10
|
-
raise ArgumentError.new(
|
10
|
+
raise ArgumentError.new('Log.log :parent => ... argument must be an Effective::Log object')
|
11
11
|
end
|
12
12
|
|
13
13
|
if options[:associated].present? && !options[:associated].kind_of?(ActiveRecord::Base)
|
14
|
-
raise ArgumentError.new(
|
14
|
+
raise ArgumentError.new('Log.log :associated => ... argument must be an ActiveRecord::Base object')
|
15
15
|
end
|
16
16
|
|
17
|
-
Effective::Log.new(
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
17
|
+
log = Effective::Log.new(
|
18
|
+
message: message,
|
19
|
+
status: status,
|
20
|
+
user_id: options.delete(:user_id),
|
21
|
+
user: options.delete(:user),
|
22
|
+
parent: options.delete(:parent),
|
23
|
+
associated: options.delete(:associated),
|
24
|
+
associated_to_s: options.delete(:associated_to_s)
|
25
|
+
)
|
26
|
+
|
27
|
+
if log.associated.present?
|
28
|
+
log.associated_to_s ||= (log.associated.to_s rescue nil)
|
29
|
+
end
|
30
30
|
|
31
|
-
|
31
|
+
log.details = options.delete_if { |k, v| v.blank? } if options.kind_of?(Hash)
|
32
32
|
|
33
|
-
|
34
|
-
end
|
33
|
+
log.save
|
35
34
|
end
|
36
35
|
|
37
36
|
# Dynamically add logging methods based on the defined statuses
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_logging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|