X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Fuvl%2Fluasrc%2Fuvl%2Floghelper.lua;fp=libs%2Fuvl%2Fluasrc%2Fuvl%2Floghelper.lua;h=0000000000000000000000000000000000000000;hb=aa94931fa01c63f9644056eed73ea9c6a665b6ca;hp=91da1ac35bf875631e55bc52b599232ccc46f70a;hpb=86a3d500d116ce60658fd12bbee04873bc531144;p=project%2Fluci.git diff --git a/libs/uvl/luasrc/uvl/loghelper.lua b/libs/uvl/luasrc/uvl/loghelper.lua deleted file mode 100644 index 91da1ac35..000000000 --- a/libs/uvl/luasrc/uvl/loghelper.lua +++ /dev/null @@ -1,81 +0,0 @@ ---[[ - -UCI Validation Layer - Logging utilities -(c) 2008 Jo-Philipp Wich -(c) 2008 Steven Barth - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - -]]-- - -module( "luci.uvl.loghelper", package.seeall ) - -function config_error( config, message ) - return string.format( - 'Error in config "%s":\n%s', - config, message or "Unknown error" - ) -end - -function section_error( section, message ) - return string.format( - 'Error in section "%s":\n%s', - section:cid(), message or "Unknown error" - ) -end - -function validator_error( option, message ) - return string.format( - 'External validator in option "%s" failed:\n%s', - option:cid(), message or "Unknown error" - ) -end - -function scheme_error( scheme, message ) - return string.format( - 'Error while loading scheme "%s":\n%s', - scheme, message:gsub("^.-:.-: ","") - ) -end - -function dump_dependency( dep, ref, v, e ) - local str = nil - - for k, v in luci.util.spairs( dep, - function(a,b) - a = ( type(dep[a]) ~= "boolean" and "_" or "" ) .. a - b = ( type(dep[b]) ~= "boolean" and "_" or "" ) .. b - return a < b - end - ) do - str = ( str and str .. " and " or "Dependency (" ) .. k .. - ( type(v) ~= "boolean" and "=" .. v or "" ) - end - - str = string.format( - '%s) failed:\n\t%s', - str, e and e:gsub("\n","\n\t") or string.format( - 'Option "%s" %s', - table.concat( ref, "." ), ( - type(v) == "boolean" - and "has no value" or 'is not equal "' .. v .. '"' - ) - ) - ) - - return str -end - -function id( c, s, o ) - if type(c) == "table" then - c, s, o = unpack(c) - end - - return c .. ( s and '.' .. s or '' ) .. ( o and '.' .. o or '' ) -end