aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authoronefang2020-06-01 15:34:30 +1000
committeronefang2020-06-01 15:34:30 +1000
commitb1b16d264aa0b6311689cc4b6759dd01ff224ed1 (patch)
treeef4e922bf234ba52325055151eba5491b48b9873
parentSome more nil checks. (diff)
downloadapt-panopticon-b1b16d264aa0b6311689cc4b6759dd01ff224ed1.zip
apt-panopticon-b1b16d264aa0b6311689cc4b6759dd01ff224ed1.tar.gz
apt-panopticon-b1b16d264aa0b6311689cc4b6759dd01ff224ed1.tar.bz2
apt-panopticon-b1b16d264aa0b6311689cc4b6759dd01ff224ed1.tar.xz
Don't try to write to a log file we couldn't open.
-rwxr-xr-xapt-panopticon.lua17
1 files changed, 10 insertions, 7 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index 16a4b3a..b44843b 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -1194,13 +1194,16 @@ else
1194 end 1194 end
1195 1195
1196 local combine = function(ip, a) 1196 local combine = function(ip, a)
1197 if not APT.logOpen(hst, ip) then print('PROBLEM OPENING LOG FILE ' .. hst .. ' ' .. ip) end 1197 if not APT.logOpen(hst, ip) then
1198 APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n') 1198 print('PROBLEM OPENING LOG FILE ' .. hst .. ' ' .. ip)
1199 for i, f in pairs(a) do 1199 else
1200 f = f:sub(9, -1) 1200 APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n')
1201 APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. f .. '">' .. f .. '</a></h2>\n') 1201 for i, f in pairs(a) do
1202 for ln in io.lines('results/' .. f) do 1202 f = f:sub(9, -1)
1203 if ln:match('^' .. os.date('!%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(ln .. '\n') end -- %F isn't good enough, coz we have to escape the '-'. 1203 APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. f .. '">' .. f .. '</a></h2>\n')
1204 for ln in io.lines('results/' .. f) do
1205 if ln:match('^' .. os.date('!%Y%-%m%-%d ') .. '.*$') then APT.logFile:write(ln .. '\n') end -- %F isn't good enough, coz we have to escape the '-'.
1206 end
1204 end 1207 end
1205 end 1208 end
1206 APT.logPost() 1209 APT.logPost()