diff options
author | Christoph Helma <helma@in-silico.ch> | 2015-08-10 09:48:57 +0200 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2015-08-10 09:48:57 +0200 |
commit | 23ecfc6fa5ae4913e5cd17b7d58432d1f88d780c (patch) | |
tree | 83d78aed2b9fbaa85400be96acfa5ace56537d1c /lib/otlogger.rb | |
parent | ef76c077fd39d31fc795b842c32575f6afb9fdb2 (diff) |
transfer to new git project started
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 |