Devise / Warden Tagged logging
I wrote a middleware (actually two, but they do the same with different implementations) that logs information about signed in scopes in a Rails + Devise application. The solution works with multiple logins (like having a person logged both as an
Admin and a
User). I tested against Rails 4 and Devise
HEAD, but it should work fine in any Rails 3 application.
This solution doesn't use the
log_tags configuration option since it isn't very helpful when you need to retrieve information stored in cookies/session. That information isn't 'ready' when the
Rails::Rack::Logger is executed, since it happens way down in the middleware chain.
Add one of the following implementations to your application load path and use the following configuration to add the middleware to your application stack: