diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-02-20 16:16:56 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-02-20 16:16:56 +0000 |
commit | b6134b992fde8784c3556fbca32925e721700d32 (patch) | |
tree | fcbac8c01883209aa451282f37592ce4f5794038 /lib/otlogger.rb | |
parent | 64135ae320998a836725786f95a4efd3b63f585c (diff) |
task catches and reports errors (some dataset tests still fail)
Diffstat (limited to 'lib/otlogger.rb')
-rw-r--r-- | lib/otlogger.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/otlogger.rb b/lib/otlogger.rb new file mode 100644 index 0000000..295d0c1 --- /dev/null +++ b/lib/otlogger.rb @@ -0,0 +1,45 @@ +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 =~ /spork.rb/ or line =~ /create/ or line =~ /overwrite.rb/) + 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 |