diff options
Diffstat (limited to 'lib/otlogger.rb')
-rw-r--r-- | lib/otlogger.rb | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/lib/otlogger.rb b/lib/otlogger.rb deleted file mode 100644 index 0f0caa4..0000000 --- a/lib/otlogger.rb +++ /dev/null @@ -1,47 +0,0 @@ - -# extend logger to add current source file, line-number and source location where the log command is called -class OTLogger < Logger - - def pwd - path = Dir.pwd.to_s - index = path.rindex(/\//) - return path if index==nil - path[(index+1)..-1] - end - - def trace() - lines = caller(0) - n = 2 - line = lines[n] - - while (line =~ /error.rb/ or line =~ /create/ or line =~ /#{File.basename(__FILE__)}/) - n += 1 - line = lines[n] - end - - index = line.rindex(/\/.*\.rb/) - return line if index==nil - line[index..-1] - end - - def format(msg) - pwd.ljust(18)+" :: "+msg.to_s+" :: "+trace - end - - def debug(msg) - super format(msg) - end - - def info(msg) - super format(msg) - end - - def warn(msg) - super format(msg) - end - - def error(msg) - super format(msg) - end - -end |