Sorry. Looked in the wrong place: dvanced TraceUtils =================== By kristian mandrup, [email protected] ---
This project contains Ruby modules for eanbling advanced tracing capabilities on any ruby application, class or module. The project was inspired by TraceUtils, a little meta-programming example by Dave Thomas (See Pragmatic Bookstore - http://pragprog.com/) The original TraceUtils has been completely refactored and expanded to include: - Indentation according to nesting level of methods calls - Define sets of context filters for when to apply tracing on a method - module, class, method, instance variable and composite filters - Action handlers to handle each trace/log statement - Appenders, similar to log4j appenders, to channel trace messages to multiple consumers - Action handlers and Appenders can also have context filters registered - Custom Filters Design ------ - Log message each log message consists of the message itself and its current context. The context includes: - Modules/Classes hierarchy of the method where the log statement is called - Method - Instance variables Tracing::TraceExt is configured with a set of action handlers (see below) can be configured with a set of filters Tracing::TraceCalls each Module/Class which should have tracing applied must include the TraceCalls module when TraceCalls is included, the 'included' callback method iterates all instance methods of the module it has been included for each such instance method, it will apply a 'before' and 'after' aspect to the instance method only if all filters registered directly on TraceExt are passed. When (the application runs and) the instance method is called, each action handler registered with TraceExt is called to handle the "runtime" tracing - Filter decides whether the trace message and current context should "pass through". Multiple filters act as a filter chain, where all filters in the chain must be passed the filtered item is rejected - ModuleFilter, ClassFilter, MethodFilter, CompositeModuleFilter, CompositeClassFilter, InstanceVarFilter, CompositeInstanceVarFilter You can also specify custom filters (see class RangeFilter in filters/message_filters.rb) Filters can also include custom include/exclude filters using Procs or Classes (see test_special_filters.rb) See: - test_special_filters.rb - ActionHandler handles a runtime logging action can be configured with a set of filters and appenders if all filters are passed for the given log message and context, each appender is called in turn with the same message and context The appenders can also be set using registered appenders with symbols. Default symbol mappings are: :logger, :xml, :html, :template For more on Appenders, see section below Usage: @ah1 = Tracing::ActionHandler.new(:filters => [Module_filter_A, Method_filter_A], :appenders => [tla1]) Alternative appender configuration using symbols: @ah1 = Tracing::ActionHandler.new(:filters => [Module_filter_A, Method_filter_A], :appenders => [:template, :xml]) See: - test_action_handler.rb - Appender is configured with some appender options specific to the type of Appender must be configured with a Tracer that renders the output string which the appender the appends to some consumer, such as a stream - LoggerAppender, HtmlAppender, XmlAppender, FileAppender - TemplatateLogAppender Usage: tla1 = Tracing::TemplateLogAppender.new(:options => {:overwrite => false, :time_limit => 2.minutes}, :tracer => :string) For any Appender, the tracer configuration can be set using a symbol :string, :xml, :html. Otherwise the default tracer for the given appender is used, fx HtmlTracer for the HtmlAppender. See: - test_appender.rb Examples of use -------------- - test_filters.rb On Oct 26, 1:31 pm, Owen <[email protected]> wrote: > Hey Kris, > > I was successful on Windows. Steps: > > > gem install gemcutter (probabably didn't need this) > > gem tumble > > gem install tace-util-adv > > See screen capture: > > http://screencast.com/t/nAFfrtZu5GC9 > > My Gem environment: > > http://screencast.com/t/oVrP144ULzJ > > So now what do I do? : -) > > -Owen > > On Oct 26, 1:11 pm, Kristian <[email protected]> wrote: > > > The first release of a gem for this project has now been released! > > > It can be found here on gemcutter: > > >http://gemcutter.org/gems/trace-util-adv > > > I also published it on Github and then set the source location in > > gemcutter accordingly. > > >http://github.com/kristianmandrup/trace-util-adv > > > But somehow I can't install the gem on my machine!? > > -- > > > > gem install trace-util-adv > > > ERROR: could not find gem trace-util-adv locally or in a repository > > -- > > > Any ideas what I could be doing wrong? > > > I have installed both gemcutter and jeweler and used > > > > gem tumble > > > in order to register gemcutter as a gem registry > > > Been following these screencasts: > > >http://railscasts.com/episodes/183-gemcutter-jeweler > > > and also > > >http://railscasts.com/episodes/135-making-a-gem > > > I'm curious if you can install it? or if you know someone who could > > help me resolve this... ;) > > > PS: This is my first ever attemot at a gem release... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
