Currently I'm developing a rails project and logging is required in this project, so I used aquarium gem for doing the trick. But the problem is when printing a logging statement I must print which person who made this action, for example
include Aquarium::Aspects
include Aquarium::DSLMethods
class LoggerController < ApplicationController
Aspect.new :after, :calls_to => :index,:in_types => [ReadingsController] do |jp, obj, *args|
joinpoint=jp.target_type.to_s
write_logs_to_file( "Action => list of all readings is shown, By => #{User.find(session[:userId]).name}")
end
end
The problem is that class logger controller has no access to the session object, the question is how to wrap around this problem ?