Commit f5a07231 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

Log: deterministic option ordering

parent f8874412
......@@ -54,7 +54,8 @@ function Log:optfrags()
local targets = {}
if mode then
local optmap = {
local optmap = (
{
log={level='level', prefix='prefix'},
nflog={
group='group',
......@@ -69,14 +70,15 @@ function Log:optfrags()
threshold='qthreshold'
}
}
if not optmap[mode] then self:error('Invalid logging mode: '..mode) end
)[mode]
if not optmap then self:error('Invalid logging mode: '..mode) end
local target = mode:upper()
for s, t in pairs(optmap[mode]) do
for _, s in util.sortedkeys(optmap) do
local value = self[s]
if value then
if s == 'prefix' then value = util.quote(value) end
target = target..' --'..mode..'-'..t..' '..value
target = target..' --'..mode..'-'..optmap[s]..' '..value
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment