diff options
author | onefang | 2019-06-25 21:46:43 +1000 |
---|---|---|
committer | onefang | 2019-06-25 21:46:43 +1000 |
commit | f78da3880ca3afe1d3243da165e7941f32bc9ea7 (patch) | |
tree | 5f0b76908d66ed138cfbf13948fa7cc12ae2bab0 | |
parent | More justification. (diff) | |
download | apt-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
-rwxr-xr-x | mirror-checker.lua | 16 |
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 | } |
64 | local arg = {} | 64 | local arg = {} |
65 | local sendArgs = "" | 65 | local sendArgs = "" |
66 | local log | 66 | local logFile |
67 | 67 | ||
68 | 68 | ||
69 | local socket = require 'socket' | 69 | local 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 |
113 | end | 113 | end |
114 | local D = function(s) log(3, "DEBUG ", s) end | 114 | local D = function(s) log(3, "DEBUG ", s) end |
@@ -380,10 +380,10 @@ end | |||
380 | execute("mkdir -p results") | 380 | execute("mkdir -p results") |
381 | 381 | ||
382 | if 0 < #arg then | 382 | if 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]) |
398 | else | 398 | else |
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() |