Permalink
Browse files

removing caller_path since it was horribly buggy

  • Loading branch information...
1 parent 4cf2130 commit e64d24496b8bd25db7a7ec658104be500bacadef Rob Hurring committed Mar 10, 2011
Showing with 6 additions and 10 deletions.
  1. +1 −4 README.md
  2. +3 −3 examples/examples.rb
  3. +2 −3 lib/class_logger.rb
View
@@ -55,9 +55,6 @@ The following can be used in the *path* or *in* options.
<dt><strong>%{class_name}</strong></dt>
<dd>Will replace itself with the name of the class.</dd>
-
- <dt><strong>%{caller_path_}</strong></dt>
- <dd>Will replace itself the path of the calling file. (Useful if you want logs relative to your scripts location)</dd>
</dl>
Example Usage
@@ -100,7 +97,7 @@ Example Usage
# create a logger for a module
module Something
include ClassLogger
- has_logger :in => "%{caller_path}/log/my_module.log"
+ has_logger :in => "#{File.dirname(__FILE__)}/log/my_module.log"
has_logger :in => "/var/log/utoh.log", :as => :utoh_logger
end
Something.logger.info "Testing 123" # => goes to ./log/my_module.log
View
@@ -4,7 +4,7 @@
# test module functionality
module Hello
include ClassLogger
- has_logger :in => "%{caller_path}/%{class_name}.log", :as => :my_logger
+ has_logger :in => "#{$log_path}/%{class_name}.log", :as => :my_logger
def self.alternate
loggers[:my_logger]
@@ -17,7 +17,7 @@ def self.alternate
class Gateway
include ClassLogger
has_logger :path => $log_path, :level => Logger::ERROR
- has_logger :in => "%{caller_path}/transaction.log", :as => :transaction_logger,
+ has_logger :in => "#{$log_path}/transaction.log", :as => :transaction_logger,
:formatter => proc{ |severity, time, program_name, message| "[%s-Transaction]: %s\n" % [severity, message] }
def initialize
@@ -36,7 +36,7 @@ def transact!
# test default functionality
class Default
include ClassLogger
- has_logger :path => "%{caller_path}"
+ has_logger :path => $log_path
end
Default.new.logger.info "Testing"
View
@@ -33,10 +33,9 @@ def loggers
def setup_logger(options)
interpolations = {
:rails_root => (defined?(Rails) ? Rails.root : ''),
- :class_name => self.to_s.downcase,
- :caller_path => (File.dirname(caller[1]) rescue '.')
+ :class_name => self.to_s.downcase
}
-
+
if i = options[:in]
options[:file] = File.basename(i)
options[:path] = File.dirname(i)

0 comments on commit e64d244

Please sign in to comment.