aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2019-06-25 21:46:43 +1000
committeronefang2019-06-25 21:46:43 +1000
commitf78da3880ca3afe1d3243da165e7941f32bc9ea7 (patch)
tree5f0b76908d66ed138cfbf13948fa7cc12ae2bab0
parentMore justification. (diff)
downloadapt-panopticon-f78da3880ca3afe1d3243da165e7941f32bc9ea7.zip
apt-panopticon-f78da3880ca3afe1d3243da165e7941f32bc9ea7.tar.gz
apt-panopticon-f78da3880ca3afe1d3243da165e7941f32bc9ea7.tar.bz2
apt-panopticon-f78da3880ca3afe1d3243da165e7941f32bc9ea7.tar.xz
Make logging work.
I really should test things better before comitting them
Diffstat (limited to '')
-rwxr-xr-xmirror-checker.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/mirror-checker.lua b/mirror-checker.lua
index cd7cc3d..4ebaecb 100755
--- a/mirror-checker.lua
+++ b/mirror-checker.lua
@@ -63,7 +63,7 @@ local referenceDebs =
63} 63}
64local arg = {} 64local arg = {}
65local sendArgs = "" 65local sendArgs = ""
66local log 66local logFile
67 67
68 68
69local socket = require 'socket' 69local socket = require 'socket'
@@ -106,9 +106,9 @@ local log = function(v, t, s)
106 if 3 <= verbosity then t = os.date() .. " " .. t end 106 if 3 <= verbosity then t = os.date() .. " " .. t end
107 print(t .. ": " .. s) 107 print(t .. ": " .. s)
108 end 108 end
109 if nil ~= log then 109 if nil ~= logFile then
110 log:write(os.date() .. " " .. t .. ": " .. s .. "/n") 110 logFile:write(os.date() .. " " .. t .. ": " .. s .. "/n")
111 log:flush() 111 logFile:flush()
112 end 112 end
113end 113end
114local D = function(s) log(3, "DEBUG ", s) end 114local D = function(s) log(3, "DEBUG ", s) end
@@ -380,10 +380,10 @@ end
380execute("mkdir -p results") 380execute("mkdir -p results")
381 381
382if 0 < #arg then 382if 0 < #arg then
383 if nil ~= arg[2] 383 if nil ~= arg[2] then
384 log = io.open ("mirror-checker-lua_" .. arg[1] .. "_" .. arg[2] .. ".log", "a+") 384 logFile = io.open ("results/mirror-checker-lua_" .. arg[1] .. "_" .. arg[2] .. ".log", "a+")
385 else 385 else
386 log = io.open ("mirror-checker-lua_" .. arg[1] .. ".log", "a+" [, mode]) 386 logFile = io.open ("results/mirror-checker-lua_" .. arg[1] .. ".log", "a+")
387 end 387 end
388 local pu = url.parse("http://" .. arg[1], defaultURL) 388 local pu = url.parse("http://" .. arg[1], defaultURL)
389 I("Starting tests for " ..pu.host .. " with these tests - " .. table.concat(options.tests.value, ", ")) 389 I("Starting tests for " ..pu.host .. " with these tests - " .. table.concat(options.tests.value, ", "))
@@ -397,7 +397,7 @@ if 0 < #arg then
397 checkHost(pu.host, pu.path, arg[2]) 397 checkHost(pu.host, pu.path, arg[2])
398else 398else
399 if not keep then os.execute("rm -f results/*.log") end 399 if not keep then os.execute("rm -f results/*.log") end
400 log = io.open ("mirror-checker-lua.log", "a+") 400 logFile = io.open ("results/mirror-checker-lua.log", "a+")
401 I("Starting tests " .. table.concat(options.tests.value, ", ")) 401 I("Starting tests " .. table.concat(options.tests.value, ", "))
402 execute("mkdir -p results") 402 execute("mkdir -p results")
403 local mirrors = getMirrors() 403 local mirrors = getMirrors()