diff options
author | onefang | 2019-12-24 19:36:45 +1000 |
---|---|---|
committer | onefang | 2019-12-24 19:36:45 +1000 |
commit | 0e034f01c189e1e7bedb7e8897680b8f322ba301 (patch) | |
tree | 5715913944c96ec7407294f6230ec84f791e91e8 /apt-panopticon.lua | |
parent | Log arguments. (diff) | |
download | apt-panopticon-0e034f01c189e1e7bedb7e8897680b8f322ba301.zip apt-panopticon-0e034f01c189e1e7bedb7e8897680b8f322ba301.tar.gz apt-panopticon-0e034f01c189e1e7bedb7e8897680b8f322ba301.tar.bz2 apt-panopticon-0e034f01c189e1e7bedb7e8897680b8f322ba301.tar.xz |
Refactor logging.
Diffstat (limited to '')
-rwxr-xr-x | apt-panopticon.lua | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index 45a591f..649346a 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -922,13 +922,7 @@ if 0 < #arg then | |||
922 | 922 | ||
923 | if APT.origin or APT.redir then APT.results["IPs"] = gatherIPs(pu.host) end | 923 | if APT.origin or APT.redir then APT.results["IPs"] = gatherIPs(pu.host) end |
924 | 924 | ||
925 | local logname = pu.host | 925 | if not APT.logOpen(pu.host, arg[2], arg[3]) then return end |
926 | if nil ~= arg[2] then logname = logname .. "_" .. arg[2] end | ||
927 | if nil ~= arg[3] then logname = logname .. "_" .. arg[3] end | ||
928 | if APT.checkFile("results/LOG_" .. logname .. ".html") then return end | ||
929 | APT.logFile, e = io.open("results/LOG_" .. logname .. ".html", "a+") | ||
930 | if nil == APT.logFile then C("opening log file - " .. e); return end | ||
931 | APT.logPre() | ||
932 | I("Starting tests for " .. arg[1] .. " with these tests - " .. table.concat(APT.options.tests.value, ", ")) | 926 | I("Starting tests for " .. arg[1] .. " with these tests - " .. table.concat(APT.options.tests.value, ", ")) |
933 | if nil ~= arg[2] then I(" Using IP " .. arg[2]); ip = arg[2] end | 927 | if nil ~= arg[2] then I(" Using IP " .. arg[2]); ip = arg[2] end |
934 | if nil ~= arg[3] then I(" Using file " .. arg[3]); end | 928 | if nil ~= arg[3] then I(" Using file " .. arg[3]); end |
@@ -1005,7 +999,6 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. | |||
1005 | end | 999 | end |
1006 | 1000 | ||
1007 | APT.logPost() | 1001 | APT.logPost() |
1008 | APT.logFile:close() | ||
1009 | else | 1002 | else |
1010 | local fadt = io.popen("ls -dl results_old 2>/dev/null | cut -d '>' -f 2 | cut -d ' ' -f 2") | 1003 | local fadt = io.popen("ls -dl results_old 2>/dev/null | cut -d '>' -f 2 | cut -d ' ' -f 2") |
1011 | local adt = fadt:read('*l') | 1004 | local adt = fadt:read('*l') |
@@ -1024,9 +1017,7 @@ else | |||
1024 | os.execute("rm -f results/*.txt 2>/dev/null") | 1017 | os.execute("rm -f results/*.txt 2>/dev/null") |
1025 | end | 1018 | end |
1026 | 1019 | ||
1027 | APT.logFile, e = io.open("results/LOG_apt-panopticon.html", "a+") | 1020 | if not APT.logOpen('apt-panopticon') then return end |
1028 | if nil == APT.logFile then C("opening log file - " .. e); return end | ||
1029 | APT.logPre() | ||
1030 | I("Starting tests " .. table.concat(APT.options.tests.value, ", ")) | 1021 | I("Starting tests " .. table.concat(APT.options.tests.value, ", ")) |
1031 | os.execute("mkdir -p results") | 1022 | os.execute("mkdir -p results") |
1032 | APT.mirrors = getMirrors() | 1023 | APT.mirrors = getMirrors() |
@@ -1069,5 +1060,4 @@ os.execute('sleep 1') -- Wait for things to start up before checking for them. | |||
1069 | 1060 | ||
1070 | I('Total run time was ' .. (os.time() - now) .. ' seconds.') | 1061 | I('Total run time was ' .. (os.time() - now) .. ' seconds.') |
1071 | APT.logPost() | 1062 | APT.logPost() |
1072 | APT.logFile:close() | ||
1073 | end | 1063 | end |