summaryrefslogtreecommitdiff
path: root/lib/environment.rb
diff options
context:
space:
mode:
authorMartin Gütlein <martin.guetlein@gmail.com>2010-02-23 11:30:25 +0100
committerMartin Gütlein <martin.guetlein@gmail.com>2010-02-23 11:30:25 +0100
commitfdafd34343b420ad66b8ebf2b29fa4775830f73a (patch)
tree2ee0c24b23289e49aabf2b6c94f6e0d69010714e /lib/environment.rb
parenta90f1ea5513997c96492bdf8e92bab39c3fea406 (diff)
add logging info
Diffstat (limited to 'lib/environment.rb')
-rw-r--r--lib/environment.rb41
1 files changed, 40 insertions, 1 deletions
diff --git a/lib/environment.rb b/lib/environment.rb
index fedc3cf..b796b6d 100644
--- a/lib/environment.rb
+++ b/lib/environment.rb
@@ -39,8 +39,47 @@ if @@config[:database]
end
# logging
+class MyLogger < Logger
+
+
+ def trace()
+ lines = caller(0)
+# puts lines.join("\n")
+# puts "-"
+ line = lines[2]
+# puts line
+# puts "-"
+ index = line.rindex(/\/.*\.rb/)
+# raise "index = nil" if index==nil
+ return line if index==nil
+# puts "<<< "+line[index..-1].size.to_s+" <<< "+line[index..-1]
+# raise "stop"
+ line[index..-1]
+ end
+
+ def debug(param)
+ super trace.ljust(50)+" :: "+param.to_s
+ end
+
+ def info(param)
+ super trace.ljust(50)+" :: "+param.to_s
+ end
+
+ def warn(param)
+ super trace.ljust(50)+" :: "+param.to_s
+ end
+
+ def error(param)
+ super trace.ljust(50)+" :: "+param.to_s
+ end
+
+end
+
logfile = "#{LOG_DIR}/#{ENV["RACK_ENV"]}.log"
-LOGGER = Logger.new(logfile,'daily') # daily rotation
+
+LOGGER = MyLogger.new(logfile,'daily') # daily rotation
+#LOGGER = MyLogger.new(STDOUT)
+
LOGGER.level = Logger::DEBUG
# RDF namespaces