Permalink
Browse files

braking interpolations out into their own special hash (in case it sh…

…ould become user controlled in the future)
  • Loading branch information...
1 parent 6883a5b commit ab52933ddebfaa9e065d3c70616d3771e57c721f @robhurring committed Jan 27, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/class_logger.rb
View
@@ -28,8 +28,14 @@ def loggers
end
def setup_logger(options)
- file_path = File.join(options[:path], options[:in]).to_s % \
- {:rails_root => (defined?(Rails) ? Rails.root : ''), :class_name => self.to_s.downcase}
+ interpolations = {
+ :rails_root => (defined?(Rails) ? Rails.root : ''),
+ :class_name => self.to_s.downcase,
+ :current => File.dirname($FILENAME),
+ :parent => File.expand_path('../../', $FILENAME)
+ }
+
+ file_path = File.join(options[:path], options[:in]).to_s % interpolations
if (rotate = options[:rotate])
_logger = ::Logger.new(file_path, rotate)
else

0 comments on commit ab52933

Please sign in to comment.