elseif opt:find("outfile=", 1, true) then
outfile = opt:match("[^%c]+", 9)
else
- io.stderr:write("FATAL: unsupported option: " .. opt .. "\n")
+ io.stderr:write(string.format("FATAL: unsupported option: '%s'\n", opt))
os.exit(1)
end
end
outp, err = io.open(outfile, "w+")
if err then
args_valid=false
- io.stderr:write("FATAL: failed to open output stream at '", outfile, "'\n")
+ io.stderr:write(string.format("FATAL: failed to open output stream at '%s'\n", outfile))
end
end
pidf:close()
else
args_valid=false
- io.stderr:write("FATAL: failed to record PID info in '", pidfile, "'\n")
+ io.stderr:write(string.format("FATAL: failed to record PID info in '%s'\n", pidfile))
end
end
udpl:setsockname("*", listenport)
udpl:settimeout(0.1)
outp:setvbuf("line")
-io.stderr:write("netconsole-rx.lua | pid " .. mypid .. " | input UDP port " .. listenport .. " | output '" .. outfile .. "'\n")
+io.stderr:write(string.format("%s INFO: netconsole-rx.lua | pid %d | input udp port %d | output %s\n", isoutctime(), mypid, listenport, outfile))
-- processing loop --
-- outp:write(string.format("%s:%s \t%s\n", peer, peerport, mdata))
outp:write(string.format("%s %s:%s \t%s\n", isoutctime(), peer, peerport, data))
else
- io.stderr:write("WARN: garbage input from peer " .. peer .. ":" .. peerport .. " discarded\n")
+ io.stderr:write(string.format("%s WARN: garbage input from peer %s:%d discarded\n", isoutctime(), peer, peerport))
end
end
end