diff options
Diffstat (limited to '')
-rw-r--r-- | apt-panopticommon.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index d8ab129..54e2be1 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua | |||
@@ -315,7 +315,18 @@ APT.results = {} | |||
315 | APT.logFile = nil | 315 | APT.logFile = nil |
316 | APT.html = false | 316 | APT.html = false |
317 | 317 | ||
318 | APT.logPre = function() | 318 | APT.logName = function(host, a2, a3) |
319 | local name = host | ||
320 | if nil ~= a2 then name = name .. "_" .. a2 end | ||
321 | if nil ~= a3 then name = name .. "_" .. a3 end | ||
322 | return 'results/LOG_' .. name .. '.html' | ||
323 | end | ||
324 | |||
325 | APT.logOpen = function(host, a2, a3) | ||
326 | local name = APT.logName(host, a2, a3) | ||
327 | if APT.checkFile(name) then return false end | ||
328 | APT.logFile, e = io.open(name, "a+") | ||
329 | if nil == APT.logFile then C('opening log file (' .. name .. ') - ' .. e); return false end | ||
319 | if nil ~= APT.logFile then | 330 | if nil ~= APT.logFile then |
320 | APT.logFile:write("<html><head>\n") | 331 | APT.logFile:write("<html><head>\n") |
321 | APT.logFile:write("</head><body bgcolor='black' text='white' alink='red' link='blue' vlink='purple'>\n") | 332 | APT.logFile:write("</head><body bgcolor='black' text='white' alink='red' link='blue' vlink='purple'>\n") |
@@ -323,10 +334,13 @@ APT.logPre = function() | |||
323 | APT.logFile:write(APT.dumpTable(APT.args, '', 'Arguments')) | 334 | APT.logFile:write(APT.dumpTable(APT.args, '', 'Arguments')) |
324 | APT.logFile:write("</pre>\n") | 335 | APT.logFile:write("</pre>\n") |
325 | end | 336 | end |
337 | return true | ||
326 | end | 338 | end |
339 | |||
327 | APT.logPost = function() | 340 | APT.logPost = function() |
328 | if nil ~= APT.logFile then | 341 | if nil ~= APT.logFile then |
329 | APT.logFile:write("</body></html> \n") | 342 | APT.logFile:write("</body></html> \n") |
343 | APT.logFile:close() | ||
330 | end | 344 | end |
331 | end | 345 | end |
332 | 346 | ||