Created
March 17, 2009 06:45
-
-
Save deepthawtz/80356 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up the logger. | |
# | |
# Place the logger inside of the Merb log directory (set up in | |
# Merb::BootLoader::BuildFramework) | |
class Merb::BootLoader::Logger < Merb::BootLoader | |
# Sets Merb.logger to a new logger created based on the config settings. | |
# | |
# ==== Returns | |
# nil | |
# | |
# :api: plugin | |
def self.run | |
Merb::Config[:log_level] ||= begin | |
if Merb.environment == "production" | |
Merb::Logger::Levels[:warn] | |
else | |
Merb::Logger::Levels[:debug] | |
end | |
end | |
Merb::Config[:log_stream] = | |
Merb::Config[:original_log_stream] || Merb.log_stream | |
print_warnings | |
nil | |
end | |
# Print a warning if the installed version of rubygems is not supported | |
# | |
# ==== Returns | |
# nil | |
# | |
# :api: private | |
def self.print_warnings | |
if Gem::Version.new(Gem::RubyGemsVersion) < Gem::Version.new("1.1") | |
Merb.fatal! "Merb requires Rubygems 1.1 and later. " \ | |
"Please upgrade RubyGems with gem update --system." | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment