开发者

Rails server reduce verbosity?

One method of debugging within the Controllers I have learnt from Django is to actually print out variables within the controllers itself. However, I realize that this method is not as practical in rails as the default rails webserver is pretty verbose and it's making me difficult to trace.

FYI I read about the rails debugging page but most of those debug techniques exist in the VIEW layer (like <% @myvar.debug %>). I want to be able to see the state of vars inside the controllers and I don't wan开发者_如何学编程t to use the rails debugger as it's kind of an overkill for something so simple.

My question is: is there a variable that I can set to reduce statements like those below from being produced at each page serve?

Started POST "/submissions" for 127.0.0.1 at 2011-06-02 02:35:38 -0400
  Processing by SubmissionsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"U+I2mSfCRFvOyT/L82TTzsVRVJQuJbB+X3SaMWr/IM4=", "submission"=>{"url"=>"http://wasdvasd.com", "receiver_id"=>"1", "comment"=>"asdvasdvasdv"}, "commit"=>"Create Submission"}
  User Load (0.5ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
  Link Load (0.1ms)  SELECT "links".* FROM "links" WHERE "links"."url" = 'http://wasdvasd.com' LIMIT 1
  AREL (0.3ms)  INSERT INTO "links" ("url", "created_at", "updated_at") VALUES ('http://wasdvasd.com', '2011-06-02 06:35:38.399463', '2011-06-02 06:35:38.399463')
  AREL (0.2ms)  INSERT INTO "submissions" ("link_id", "author_id", "receiver_id", "comment", "visited", "created_at", "updated_at") VALUES (5, 1, 1, 'asdvasdvasdv', NULL, '2011-06-02 06:35:38.402094', '2011-06-02 06:35:38.402094')
Redirected to http://localhost:3000/submissions
Completed 302 Found in 244ms


You should be able to change the logging level in your config/environments/*.rb files.

See: http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels for the different log levels.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜