I never used debugger before, having done well so far just using
logger.debug statements.
I installed the ruby-debugger gem
Inserted
require 'ruby-debug'
at the top of template_environment.rb
Then inserted debugger as the first statement inside these functions:
def call_tag_parameter_with_default_content
debugger
def call_tag_parameter(the_tag, attributes, parameters,
caller_parameters, param_name)
debugger
def override_and_call_tag(the_tag, general_attributes,
general_parameters, overriding_attributes, overriding_parameters)
debugger
---
module Hobo::Dryml
require 'ruby-debug'
class TemplateEnvironment
@debug_a = true
@separator = ""
class << self
...
def call_tag_parameter_with_default_content(the_tag, attributes,
default_content, overriding_content_proc)
debugger
separator = attributes.key?(:separator) ? attributes[:separator] : ""
logger.info("CALL_TAG_PARAMATER_WITH_DEFAULT_CONTENT the_tag: " +
the_tag.to_s + " : " + separator) if @debug_a
if the_tag.is_one_of?(String, Symbol) && the_tag.to_s.in?
(Hobo.static_tags)
logger.info("AA CALL_TAG_PARAMATER_WITH_DEFAULT_CONTENT the_tag: " +
the_tag.to_s + " : " + separator) if @debug_a
body = if overriding_content_proc
logger.info("AB CALL_TAG_PARAMATER_WITH_DEFAULT_CONTENT the_tag: " +
the_tag.to_s + " : " + separator) if @debug_a
new_context { overriding_content_proc.call(proc
{ default_content._?.call(nil) }) }
elsif default_content
logger.info("AC CALL_TAG_PARAMATER_WITH_DEFAULT_CONTENT the_tag: " +
the_tag.to_s + " : " + separator) if @debug_a
new_context { default_content.call(nil) }
else
logger.info("AD CALL_TAG_PARAMATER_WITH_DEFAULT_CONTENT the_tag: " +
the_tag.to_s + " : " + separator) if @debug_a
nil
end
element(the_tag, attributes, body)
else
logger.info("BB overriding_content_proc:" +
overriding_content_proc.class.to_s ) if @debug_a
d = if overriding_content_proc
logger.info("BC CALL_TAG_PARAMATER_WITH_DEFAULT_CONTENT the_tag: " +
the_tag.to_s + " : " + separator) if @debug_a
proc { |default| overriding_content_proc.call(proc
{ default_content._?.call(default) }) }
else
logger.info("BD CALL_TAG_PARAMATER_WITH_DEFAULT_CONTENT the_tag: " +
the_tag.to_s + " : " + separator) if @debug_a
proc { |default| default_content._?.call(default) }
end
logger.info("BE CALL_TAG_PARAMATER_WITH_DEFAULT_CONTENT the_tag: " +
the_tag.to_s + " : " + separator) if @debug_a
@separator = [separator]
out = send(the_tag, attributes, { :default => d })
@separator = ""
out
end
end
---
But still I get no logging output from here and the debugger never
comes into action. Somehow it seems I never call these functions when
rendering he front/index or recipes/index!?
I tried running using:
> rdebugger script/server
and
> script/server --debugger
But to no effect. The debugger only take effect when it loads... ?
0xbcb1558f:log-hobo kristianconsult$ rdebug script/server
/Users/kristianconsult/my_rails/hobo-apps/testing/log-hobo/script/
server:2
require File.expand_path('../../config/boot', __FILE__)
(rdb:1) n
/Users/kristianconsult/my_rails/hobo-apps/testing/log-hobo/script/
server:3
require 'commands/server'
(rdb:1) n
=> Booting Mongrel
=> Rails 2.3.4 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Processing RecipesController#index (for 127.0.0.1 at 2009-09-26
14:24:44) [GET]
User Load (0.5ms) SELECT * FROM "users" WHERE ("users"."id" = 1)
Recipe Load (0.2ms) SELECT * FROM "recipes" LIMIT 30 OFFSET 0
Rendering recipes/index
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/core.dryml in 0.02s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/rapid_core.dryml in
0.23s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/rapid_support.dryml
in 0.02s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/
rapid_document_tags.dryml in 0.12s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/rapid_pages.dryml
in 0.22s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/rapid_editing.dryml
in 0.06s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/rapid_forms.dryml
in 0.24s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/
rapid_navigation.dryml in 0.11s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/rapid_plus.dryml in
0.08s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/
rapid_generics.dryml in 0.02s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/
rapid_lifecycles.dryml in 0.01s
DRYML: Compiled vendor/plugins/hobo/hobo/taglibs/rapid.dryml in
1.13s
DRYML: Compiled app/views/taglibs/auto/rapid/cards.dryml in 0.02s
DRYML: Compiled app/views/taglibs/auto/rapid/pages.dryml in 0.23s
DRYML: Compiled app/views/taglibs/auto/rapid/forms.dryml in 0.12s
DRYML: Compiled app/views/taglibs/themes/clean/clean.dryml in 0.01s
DRYML: Compiled app/views/taglibs/application.dryml in 1.54s
DRYML: Compiled app/views/recipes/index.dryml in 1.57s
User Load (0.4ms) SELECT * FROM "users" LIMIT 30
Completed in 1691ms (View: 1685, DB: 1) | 200 OK [http://localhost/
recipes]
Any ideas?
---
On Sep 25, 2:29 pm, Bryan Larsen <[email protected]> wrote:
> Hmmm, I usually like to name my loggers my_logger (or something
> similar) to avoid potential collisions.
>
> I'm not sure why you're not seeing output: I've successfully thrown
>
> require 'ruby-debug'; debugger
>
> in template_environment.rb before.
>
> Bryan
>
> On Sep 25, 5:46 am, Kristian <[email protected]> wrote:
>
> > I have a logger available in template.rb through the logger method
>
> > def logger
> > ActionController::Base.logger rescue nil
> > end
>
> > But no matter what I do (so far!), if I try to add a logger to
> > template_environment.rb, and do a logger.debug('..') nothing is output
> > in the console. Any solutions?
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---