Richard
2006-Nov-20 23:38 UTC
Using Aspect Oriented Programming in Ruby to simplify tracing
Is their a simple way to automatically insert a trace function invocation at the start or every method of a rails app? I want to use SimpleTrace to an IO stream or logger.debug to the log file to output each invoked method''s name and the arguments it''s called with, at a minimum. I understand that''s an easy thing to do with Aspect. I see that there''s a patch to Ruby 1.8.2 that introduces a Cut that implements AOP for Ruby. Has anybody used it? And I wonder whether it would do what I want to do. (I only skimmed it''s description.) Is there some other implementation "out there?" Regards, Richard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Richard Lionheart
2006-Nov-21 04:47 UTC
Using Aspect Oriented Programming in Ruby to simplify tracing
Hi, (Note: This was originally submitted to Ruby-Talk on Google Groups, but it failed to get posted. Hence this was submitted to gmane.comp.lang.ruby.rails using Outlook Express. Hopefully it will have a better fate.) Is there a simple way to automatically insert a trace function invocation at the start or every method of a rails app? I want to use SimpleTrace to an IO stream or logger.debug to the log file to output each invoked method''s name and the arguments it''s called with, at a minimum. I understand that''s an easy thing to do with Aspect. I see that there''s a patch to Ruby 1.8.2 that introduces a Cut that implements AOP for Ruby. Has anybody used it? And I wonder whether it would do what I want to do. (I only skimmed it''s description.) Is there some other implementation "out there?" Regards, Richard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Richard
2006-Nov-21 05:27 UTC
Re: Using Aspect Oriented Programming in Ruby to simplify tracing
An alternative idea: Is it possible to put some kind of "before: ShowFilename" and define the ShowFilename method in top-level code that will be inherited by all other code in the app (with ShowFilename writing something like _FILENAME_ evaluated in the context of the lower-level code)? I''ve seen some neat Ruby metaprogramming examples, but I''m too new to Ruby to implement my idea. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Richard
2006-Nov-21 05:39 UTC
Re: Using Aspect Oriented Programming in Ruby to simplify tracing
An alternative idea: Is it possible to put some kind of ":before ShowFilename", with the ShowFilename method defined in top-level code that will be inherited by all other code in the app ... with ShowFilename writing something like _FILENAME_ evaluated in the context of the lower-level code? I''ve seen some neat Ruby metaprogramming examples, but I''m too new to Ruby to implement my idea without some guidance. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Richard
2006-Nov-28 03:42 UTC
Re: Using Aspect Oriented Programming in Ruby to simplify tracing
I got a couple of good answers at http://groups.google.com/group/microsoft.public.office.misc/tree/browse_frm/thread/93649aab3f5e4eec/6e4ae772e7dc0e42?rnum=1&_done=%2Fgroup%2Fmicrosoft.public.office.misc%2Fbrowse_frm%2Fthread%2F93649aab3f5e4eec%3F#doc_6e4ae772e7dc0e42 As far as I''m concerned, this thread is dead. Richard Lionheart wrote:> Hi, > > (Note: This was originally submitted to Ruby-Talk on Google Groups, but it > failed to get posted. Hence this was submitted to > gmane.comp.lang.ruby.rails using Outlook Express. Hopefully it will have a > better fate.) > > Is there a simple way to automatically insert a trace function invocation at > the start or every method of a rails app? I want to use SimpleTrace to an > IO stream or logger.debug to the log file to output each invoked method''s > name and the arguments it''s called with, at a minimum. > > > > I understand that''s an easy thing to do with Aspect. I see that there''s a > patch to Ruby 1.8.2 that introduces a Cut that implements AOP for Ruby. > > > > Has anybody used it? And I wonder whether it would do what I want to do. > (I only skimmed it''s description.) > > > > Is there some other implementation "out there?" > > > > Regards, > > Richard--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---