This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
Chris Powers (author)
Tue Nov 18 13:53:20 -0800 2008
| name | age | message | |
|---|---|---|---|
| |
README.rdoc | ||
| |
init.rb | ||
| |
lib/ |
LogCabin
Developed by Chris Powers, Killswitch Collective (www.killswitchcollective.com)
Version 0.1, 11/18/2008
The LogCabin plugin is designed to give you the flexibility to write information about blocks of code and their execution times to specific log files in your Rails project.
This is especially useful when monitoring and debugging a specific set of code in a model or controller file. For example:
class UsersController < ApplicationController
def index
LogCabin.log_to :users_query do |log|
log.info "Finding all users with params = '#{params[:user_search].map{|k,v| "#{k}: #{v}"}.join(', ')}'"
@users = User.search(params[:user_search])
log.info "Found a total of #{@users.length} users"
end
end
end
This would print this out to /log/users_query.log:
INFO: Finding all users with params = 'last_name: Smith, city: Chicago' INFO: Found a total of 32 users TIME: Tue Nov 18 12:34:52 -0600 2008: Operation took 3.2876 seconds
It is also possible to pass an :if or :unless option to LogCabin#log_to, ex:
LogCabin.log_to :users_query, :if => RAILS_ENV == 'development' do |log|
log.info "This will not output anything unless we're in development"
puts "But any other Ruby code ni this block will always be run"
end












