]> granicus.if.org Git - pdns/commitdiff
Added few missing loggings
authorAki Tuomi <cmouse@desteem.org>
Thu, 23 Jan 2014 17:09:31 +0000 (19:09 +0200)
committerAki Tuomi <cmouse@desteem.org>
Thu, 23 Jan 2014 17:09:31 +0000 (19:09 +0200)
modules/remotebackend/regression-tests/dnsbackend.rb
modules/remotebackend/regression-tests/unix-backend.rb

index b26e478dad3974862c6083d8bc35e6220847d55a..35de50207ffce44629d0094cc92145c21f9b6f56 100644 (file)
@@ -5,7 +5,7 @@ class DNSBackendHandler < WEBrick::HTTPServlet::AbstractServlet
    def initialize(server, dnsbackend)
      @dnsbackend = dnsbackend
      @semaphore = Mutex.new
-     @f = File.open("/tmp/remotebackend.txt","a")
+     @f = File.open("/tmp/remotebackend.txt.#{$$}","a")
      @f.sync
    end
 
@@ -103,21 +103,21 @@ class DNSBackendHandler < WEBrick::HTTPServlet::AbstractServlet
 
      args = parse_arrays args
  
-     @f.puts method
-     @f.puts args
+     @f.puts "#{Time.now.to_f} [http]: #{({:method=>method,:parameters=>args}).to_json}"
 
      @semaphore.synchronize do
        if @dnsbackend.respond_to?(method.to_sym)
-          result, log = @dnsbackend.send(method.to_sym, args)
-          body = {:result => result, :log => log}
-          res.status = 200
-          res["Content-Type"] = "application/javascript; charset=utf-8"
-          res.body = body.to_json
-        else
-          res.status = 404
-          res["Content-Type"] = "application/javascript; charset=utf-8"
-          res.body = ({:result => false, :log => ["Method not found"]}).to_json
-        end
+         result, log = @dnsbackend.send(method.to_sym, args)
+         body = {:result => result, :log => log}
+         res.status = 200
+         res["Content-Type"] = "application/javascript; charset=utf-8"
+         res.body = body.to_json
+       else
+         res.status = 404
+         res["Content-Type"] = "application/javascript; charset=utf-8"
+         res.body = ({:result => false, :log => ["Method not found"]}).to_json
+       end
+       @f.puts "#{Time.now.to_f} [http]: #{res.body}" 
      end
    end
 
index a1f79daed2d4d5f682b8be1ee54e25f383682bed..c3037146af1a27129f79edc818fb16b050b645ee 100755 (executable)
@@ -7,7 +7,7 @@ require "backend"
 
 h = Handler.new("#{File.dirname(__FILE__)}/remote.sqlite3")
 
-f = File.open "/tmp/remotebackend.txt","a"
+f = File.open "/tmp/remotebackend.txt.#{$$}","a"
 f.sync = true
 
 STDOUT.sync = true