We log the login parameter and the request IP address. Quoting the ENS: > [op.acc.5.r5.1] Se registrarán los accesos con éxito y los fallidos.
25 lines
492 B
Ruby
25 lines
492 B
Ruby
class AuthenticationLogger
|
|
@loggers = {}
|
|
|
|
class << self
|
|
def log(message)
|
|
logger.info(message)
|
|
end
|
|
|
|
def path
|
|
Rails.root.join("log", Tenant.subfolder_path, "authentication.log")
|
|
end
|
|
|
|
private
|
|
|
|
def logger
|
|
@loggers[Apartment::Tenant.current] ||= build_logger
|
|
end
|
|
|
|
def build_logger
|
|
FileUtils.mkdir_p(File.dirname(path))
|
|
ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(path, level: :info))
|
|
end
|
|
end
|
|
end
|