audited_logfile 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/audited_logfile.rb +4 -3
- metadata +1 -1
data/lib/audited_logfile.rb
CHANGED
@@ -33,7 +33,8 @@ module Audited
|
|
33
33
|
class Audit < ::ActiveRecord::Base
|
34
34
|
before_create do |record|
|
35
35
|
changes = audited_changes.map { |k, v| "#{k}: #{v.is_a?(Array) ? "[#{v.first}, #{v.last}]" : v}"}.join(', ')
|
36
|
-
|
36
|
+
user_info = user ? "#{user_type}(#{user_id}): #{user.try(:email)}" : 'Guest'
|
37
|
+
AuditedLogfile.logger.info "#{Time.now.iso8601(1)}, #{action.upcase}, #{user_info}, #{auditable_type}, #{auditable_id}, (#{changes})"
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
@@ -71,9 +72,9 @@ module ActiveRecord
|
|
71
72
|
end
|
72
73
|
|
73
74
|
Warden::Manager.after_authentication do |user,auth,opts|
|
74
|
-
AuditedLogfile.logger.info "#{Time.now.iso8601(1)}, SIGNIN, #{user.email}"
|
75
|
+
AuditedLogfile.logger.info "#{Time.now.iso8601(1)}, SIGNIN, #{user.class}(#{user.id}): #{user.email}"
|
75
76
|
end
|
76
77
|
|
77
78
|
Warden::Manager.before_logout do |user,auth,scope|
|
78
|
-
AuditedLogfile.logger.info "#{Time.now.iso8601(1)}, SIGNOUT, #{user
|
79
|
+
AuditedLogfile.logger.info "#{Time.now.iso8601(1)}, SIGNOUT, #{user.class}(#{user.id}): #{user.email}"
|
79
80
|
end
|