Commit f5a07231 authored by Kaarle Ritvanen's avatar Kaarle Ritvanen

Log: deterministic option ordering

parent f8874412
...@@ -54,29 +54,31 @@ function Log:optfrags() ...@@ -54,29 +54,31 @@ function Log:optfrags()
local targets = {} local targets = {}
if mode then if mode then
local optmap = { local optmap = (
log={level='level', prefix='prefix'}, {
nflog={ log={level='level', prefix='prefix'},
group='group', nflog={
prefix='prefix', group='group',
range='size', prefix='prefix',
threshold='threshold' range='size',
}, threshold='threshold'
ulog={ },
group='nlgroup', ulog={
prefix='prefix', group='nlgroup',
range='cprange', prefix='prefix',
threshold='qthreshold' range='cprange',
threshold='qthreshold'
}
} }
} )[mode]
if not optmap[mode] then self:error('Invalid logging mode: '..mode) end if not optmap then self:error('Invalid logging mode: '..mode) end
local target = mode:upper() local target = mode:upper()
for s, t in pairs(optmap[mode]) do for _, s in util.sortedkeys(optmap) do
local value = self[s] local value = self[s]
if value then if value then
if s == 'prefix' then value = util.quote(value) end if s == 'prefix' then value = util.quote(value) end
target = target..' --'..mode..'-'..t..' '..value target = target..' --'..mode..'-'..optmap[s]..' '..value
end end
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