Is there a better way to log request body?

378 views
Skip to first unread message

Eric Francis

unread,
Mar 17, 2014, 10:57:21 AM3/17/14
to httpar...@googlegroups.com
Hello, I am currently logging requests like so:

puts response.request.instance_variable_get(:@raw_request).body

Is there a better way to do this?

I've found this example in the code:
    
     # Turns on logging
    #
    #   class Foo
    #     include HTTParty
    #     logger Logger.new('http_logger'), :info, :apache
    #   end
    def logger(logger, level=:info, format=:apache)
      default_options[:logger]     = logger
      default_options[:log_level]  = level
      default_options[:log_format] = format
    end

When I add 
logger Logger.new('http_logger'), :info, :apache 
to my code I get this error: 
NoMethodError: undefined method `new' for HTTParty::Logger:Module

Thanks!
Eric

Also, is there a way to format text as code?

Reply all
Reply to author
Forward
0 new messages