Sha256: fc3b248dea95824d75942dc586facfaf6795a77797bb9ab8054ddcad7de77bf0
Contents?: true
Size: 1.7 KB
Versions: 5
Compression:
Stored size: 1.7 KB
Contents
= lumber Lumber tries to make it easy to use the more robust log4r[http://log4r.sourceforge.net/] logging system within your rails application. To do this it sets up log4r configuration from a yml file, and provides utility methods for adding a :logger accessor to classes dynamically as they get created. In the default setup shown below, calls to logger from a model/controller/mailer, will include that classes name in the log output. To use it, first "gem install lumber", run the lumber generator (./script generate lumber) to get the log4r.yml config file, then make the following edits to config/environment.rb: # before Rails::Initializer.run # require 'lumber' Lumber.init() # Setup parent loggers for some known rails Base classes. Classes that inherit # from these will have their logger as a parent so you can configure logging for # subtrees of classes in log4r.yml Lumber.setup_logger_hierarchy("ActiveRecord::Base", "rails::models") Lumber.setup_logger_hierarchy("ActionController::Base", "rails::controllers") Lumber.setup_logger_hierarchy("ActionMailer::Base", "rails::mailers") # If you really want, you can make all classes have a logger # Lumber.setup_logger_hierarchy("Object", "root::object") If you want to change the log level for a different environment, add a line like below to the config/environments/<env>.rb # Set info as the default log level for production Log4r::Logger.root.level = Log4r::INFO You should be able to use lumber in a non-rails project too, but your call to Lumber.init will need to be different. I don't currently need to do this, so let me know if you have any problems. == Copyright Copyright (c) 2009 Matt Conway. See LICENSE for details.
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
lumber-0.9.4 | README.rdoc |
lumber-0.9.3 | README.rdoc |
lumber-0.9.2 | README.rdoc |
lumber-0.9.1 | README.rdoc |
lumber-0.9.0 | README.rdoc |