3 UCI Validation Layer - Logging utilities
4 (c) 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
5 (c) 2008 Steven Barth <steven@midlink.org>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
17 module( "luci.uvl.loghelper", package.seeall )
19 function config_error( config, message )
21 'Error in config "%s":\n%s',
22 config, message or "Unknown error"
26 function section_error( section, message )
28 'Error in section "%s":\n%s',
29 section:cid(), message or "Unknown error"
33 function validator_error( option, message )
35 'External validator in option "%s" failed:\n%s',
36 option:cid(), message or "Unknown error"
40 function dump_dependency( dep, ref, v, e )
43 for k, v in luci.util.spairs( dep,
45 a = ( type(dep[a]) ~= "boolean" and "_" or "" ) .. a
46 b = ( type(dep[b]) ~= "boolean" and "_" or "" ) .. b
50 str = ( str and str .. " and " or "Dependency (" ) .. k ..
51 ( type(v) ~= "boolean" and "=" .. v or "" )
56 str, e and e:gsub("\n","\n\t") or string.format(
58 table.concat( ref, "." ), (
60 and "has no value" or 'is not equal "' .. v .. '"'