diff options
author | Michael Koziarski <michael@koziarski.com> | 2006-02-26 19:48:33 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2006-02-26 19:48:33 +0000 |
commit | 3cfbb4f374cee2d193b80d4cd373e3fd05997027 (patch) | |
tree | 59cc4082fca85adbf8726b437180e1723cbe2c24 /activesupport/lib | |
parent | 3d1b51b4411ffe8de92d997b824637f9eaf47bb1 (diff) | |
download | rails-3cfbb4f374cee2d193b80d4cd373e3fd05997027.tar.gz rails-3cfbb4f374cee2d193b80d4cd373e3fd05997027.tar.bz2 rails-3cfbb4f374cee2d193b80d4cd373e3fd05997027.zip |
Add around methods to Logger. Closes #3809
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3670 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/logger.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/logger.rb b/activesupport/lib/active_support/core_ext/logger.rb new file mode 100644 index 0000000000..9c1fd274ac --- /dev/null +++ b/activesupport/lib/active_support/core_ext/logger.rb @@ -0,0 +1,16 @@ +# Adds the 'around_level' method to Logger. + +class Logger + def self.define_around_helper(level) + module_eval <<-end_eval + def around_#{level}(before_message, after_message, &block) + self.#{level}(before_message) + return_value = block.call(self) + self.#{level}(after_message) + return return_value + end + end_eval + end + [:debug, :info, :error, :fatal].each {|level| define_around_helper(level) } + +end
\ No newline at end of file |